home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 15 / CD_ASCQ_15_070894.iso / maj / 680 / pictor.doc < prev    next >
Text File  |  1994-03-14  |  177KB  |  4,370 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.                               PICTOR Video Library
  17.                               User's Guide and Reference
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.                               For IBM (R) personal computers
  38.                               and 100% compatibles
  39.                           PICTOR User's Guide and Reference
  40.  
  41.  
  42.           SoftCircuits and PICTOR are trademarks of SoftCircuits. All other
  43.           brands and product names are trademarks or registered trademarks
  44.           of their respective holders.
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.           PICTOR Video Library, Version 1.51
  86.           Copyright (c) 1992-94 SoftCircuits.
  87.           Redistributed by permission.
  88.  
  89.           PICTOR was designed and written by Jonathan Wood.
  90.  
  91.           SoftCircuits Programming
  92.           P.O. Box 16262
  93.           Irvine, CA 92713
  94.           U.S.A.
  95.  
  96.  
  97.  
  98.  
  99.                                           2
  100.                           PICTOR User's Guide and Reference
  101.  
  102.  
  103.           COPYRIGHTED MATERIAL
  104.           ---------------------------------------------------------------
  105.           This product (source code, object code, supporting programs, and
  106.           documentation) is protected by United States copyright law as
  107.           well as international copyright treaty provisions. SoftCircuits
  108.           is releasing this product to be used and distributed free of
  109.           charge, providing that SoftCircuits retains its copyright, and
  110.           receives credit for the work done in this product's creation.
  111.  
  112.           In keeping with the above, SoftCircuits grants to you the
  113.           following rights:
  114.  
  115.           1.   You may make any number of copies of the source code, object
  116.           code, and supporting programs, for your own use or to be
  117.           distributed to others, provided that you distribute them in the
  118.           original, unmodified form, complete with all files, copyrights
  119.           notices, etc, and that no fee is charged for such distribution
  120.           except for reasonable media and shipping charges.
  121.  
  122.           2.   You may modify the copyrighted source code, object code, and
  123.           supporting programs in connection with your use of this product.
  124.           However, under copyright law, the modified source code and
  125.           resulting object code remain the copyrighted property of
  126.           SoftCircuits, regardless of the extent of the modifications.
  127.           Therefore, you may not alter or remove any copyright notices or
  128.           similar proprietary rights notices from any portion of this
  129.           product.
  130.  
  131.           3.   You may also incorporate any of the copyrighted object code
  132.           in executable form into your own programs, and you may use and
  133.           distribute these programs royalty free, provided that all of the
  134.           following requirements are satisfied:
  135.  
  136.           a.   All copies of such programs must bear a copyright notice,
  137.                and the form of the notice must not detract from
  138.                SoftCircuits' copyright in any way. Your own copyright
  139.                notice is sufficient if it consists entirely of the
  140.                following: the word "Copyright", the years(s) of publication
  141.                of the program, and your name (or your company name).
  142.  
  143.           b.   Such programs must not substantially duplicate the overall
  144.                functionality of this product or any portion thereof.
  145.  
  146.           c.   You must assume full and complete responsibility and
  147.                liability for the operation of these programs, including
  148.                testing of all included object code to ensure that it
  149.                functions as documented and/or as expected or required.
  150.  
  151.           Except as described above, you may not legally copy or distribute
  152.           the documentation, source code, object code, or supporting
  153.           programs, in whole or in part. All rights not specifically
  154.           granted above are reserved by SoftCircuits.
  155.  
  156.  
  157.  
  158.  
  159.  
  160.                                           3
  161.                           PICTOR User's Guide and Reference
  162.  
  163.  
  164.           SOFTCIRCUITS SPECIFICALLY DISCLAIMS ALL WARRANTIES, INCLUDING,
  165.           WITHOUT LIMITATION, ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
  166.           FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT OF THIRD
  167.           PARTY RIGHTS.
  168.  
  169.           UNDER NO CIRCUMSTANCES WILL SOFTCIRCUITS BE LIABLE FOR SPECIAL,
  170.           INCIDENTAL, CONSEQUENTIAL, INDIRECT, OR ANY OTHER DAMAGES OR
  171.           CLAIMS ARISING FROM THE USE OF THIS PRODUCT, INCLUDING LOSS OF
  172.           PROFITS OR ANY OTHER COMMERCIAL DAMAGES, EVEN IF WE HAVE BEEN
  173.           ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. IN NO EVENT WILL
  174.           SOFTCIRCUITS BE LIABLE FOR ANY CLAIMS, LIABILITY, OR DAMAGES
  175.           ARISING FROM CHANGES MADE BY YOU TO THE SOURCE CODE, OBJECT CODE,
  176.           OR SUPPORTING PROGRAMS.
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219.  
  220.  
  221.                                           4
  222.                           PICTOR User's Guide and Reference
  223.  
  224.  
  225.           INTRODUCTION
  226.           -----------------------------------------------------------------
  227.           Pictor (pik'ter)  [L, painter] a constellation between Carina and
  228.           Dorado.
  229.  
  230.           PICTOR is a powerful video library designed for text-mode
  231.           applications written in C running on IBM personal computers and
  232.           100% compatibles. Features of the package include:
  233.  
  234.                   * Multi-pane stacked windows.
  235.                   * Complete pulldown menu system.
  236.                   * Complete hypertext help system and help compiler.
  237.                   * Interrupt-driven serial communications routines.
  238.                   * Ctrl-C, Ctrl-Break, and critical error handling. On
  239.                     screen Clock.
  240.                   * Text compression routines.
  241.                   * Text editor sample application that edits files up to
  242.                     available memory.
  243.                   * All source code is included.
  244.                   * Over 100 highly granular high-level and low-level
  245.                     routines provide complete control over display and
  246.                     keyboard.
  247.  
  248.           The library provides many high level routines, most of which can
  249.           easily be implemented in just one or two function calls. For
  250.           example, the Ctrl-C, Ctrl-Break and critical error handlers are
  251.           all installed (and will all uninstall automatically) with a
  252.           single function call. The library also provides many low-level
  253.           functions that provide support for custom routines that you
  254.           create.
  255.  
  256.           This package includes two sets of libraries: one for Microsoft C
  257.           7.0 and another for Borland C 3.0. Wherever practical, the
  258.           library routines are ANSI C compatible; therefore, the library
  259.           will link with programs compiled with C compilers from most other
  260.           vendors with little or no modifications.
  261.  
  262.           Please read the README.DOC file on the distribution disk(s). It
  263.           contains last minute additions and corrections to the manual.
  264.           This file also has notes about working with the source code.
  265.           Refer to the file FILELIST.DOC for a list and description of all
  266.           the files on the distribution disk(s).
  267.  
  268.  
  269.           USING PICTOR
  270.           -----------------------------------------------------------------
  271.           This section describes the key elements of the PICTOR library.
  272.           Refer to the function reference section for a comprehensive
  273.           description of all functions and macros.
  274.  
  275.           Getting Started
  276.           To install PICTOR on your system, you can use the INSTALL.EXE
  277.           program included with this package. Since none of the files on
  278.           the distribution disk(s) are compressed, you do not need to use
  279.  
  280.  
  281.  
  282.                                           5
  283.                           PICTOR User's Guide and Reference
  284.  
  285.  
  286.           this program. You might prefer to simply copy the files as you
  287.           need them. To start the installation program, make the drive that
  288.           contains the distribution disk(s) the active drive and enter the
  289.           following command at the DOS prompt:
  290.  
  291.           INSTALL
  292.  
  293.           The installation program's main menu contains the following three
  294.           selections:
  295.  
  296.           Selection                Description
  297.           -------------------------------------------------------------
  298.           Set Install Options      This selection allows you to select
  299.                                    which elements of the PICTOR package you
  300.                                    want to install.
  301.           Set Install Directories  This selection lets you specify the
  302.                                    directories where the library will be
  303.                                    installed. We recommend installing the
  304.                                    libraries and include files in your
  305.                                    compiler's library and include
  306.                                    directories.
  307.           Begin Installation       This selection begins the installation
  308.                                    process.
  309.  
  310.           The installation program will copy the selected files to the
  311.           specified directories.
  312.  
  313.           Once PICTOR is installed, you can incorporate PICTOR functions
  314.           into your program by linking your program with the library that
  315.           matches the memory model and compiler that you are using. The
  316.           library names for each memory model and compiler are as follows:
  317.  
  318.           Library Name        Memory Model and Compiler
  319.           ------------------------------------------------------------
  320.           PICTORSM.LIB        Small and tiny memory models for Microsoft C
  321.                               and Quick C.
  322.           PICTORMM.LIB        Medium memory model for Microsoft C and Quick
  323.                               C.
  324.           PICTORCM.LIB        Compact memory model for Microsoft C and
  325.                               Quick C.
  326.           PICTORLM.LIB        Large and huge memory models for Microsoft C
  327.                               and Quick C.
  328.           PICTORSB.LIB        Small and tiny memory models for Borland C
  329.                               and Turbo C.
  330.           PICTORMB.LIB        Medium memory model for Borland C and Turbo
  331.                               C.
  332.           PICTORCB.LIB        Compact memory model for Borland C and Turbo
  333.                               C.
  334.           PICTORLB.LIB        Large and huge memory models for Borland C
  335.                               and Turbo C.
  336.  
  337.           If you are compiling from the command line, be sure that the
  338.           library is passed to the linker as a library and not linked in as
  339.           an object module. The library is highly granular so only the
  340.  
  341.  
  342.  
  343.                                           6
  344.                           PICTOR User's Guide and Reference
  345.  
  346.  
  347.           routines your program uses will be linked into your executable
  348.           file; however, linking with a library as an object module will
  349.           place the entire library into your program.
  350.  
  351.           You should include the appropriate header file(s) in your source
  352.           code to insure proper type-checking of function arguments and
  353.           return values. The function reference section lists the
  354.           appropriate include file for each function or macro. We recommend
  355.           putting the include files in your compiler's include directory.
  356.           Refer to your C compiler's documentation for information about
  357.           the library and include directories and how to access the files
  358.           in those directories.
  359.  
  360.           IMPORTANT: All programs that use PICTOR library functions to
  361.           access the display should begin by calling the initvideo
  362.           function. initvideo determines the type of display adapter that
  363.           is active and sets several internal variables accordingly. You
  364.           can then use getvconfig to return information about the current
  365.           display configuration if your application needs it.
  366.  
  367.           PICTOR Windows
  368.           PICTOR library functions that write to the display can be divided
  369.           into two groups: those that are screen oriented and those that
  370.           are window oriented. The screen oriented functions can be used to
  371.           write anywhere on the screen. Window oriented functions restrict
  372.           output to within the active window pane. PICTOR provides a
  373.           stacked windowing system. Stacked windows created with wopen
  374.           remain on top of all previously created windows until they are
  375.           closed using wclose. While this method has limitations, it
  376.           provides the easiest possible interface for your applications.
  377.  
  378.           PICTOR windows can have multiple window panes. Window panes are
  379.           window subdivisions that are created using wpane, and made active
  380.           with setwpane. A window always has at least one window pane and
  381.           can have as many as the window's size and system memory will
  382.           allow.
  383.  
  384.           Using the Cursor
  385.           Within the library, there are actually three types of cursors:
  386.           the hardware text cursor, the screen's logical cursor, and the
  387.           active window pane's logical cursor. The hardware text cursor is
  388.           the visible, blinking cursor that you normally see when using
  389.           text-mode applications. The screen and active window pane's
  390.           logical cursors are not really cursors at all; they are values
  391.           maintained internally by the library to specify where screen
  392.           writes will occur. PICTOR library routines that write to the
  393.           screen pay no attention to the location of the hardware text
  394.           cursor.
  395.  
  396.           The PICTOR library's use of cursors may be a little confusing at
  397.           first if you are used to always writing to the screen at the
  398.           position of the hardware text cursor. Since the library routines
  399.           write directly to display memory, it would be additional overhead
  400.           for those functions to always program the hardware text cursor.
  401.  
  402.  
  403.  
  404.                                           7
  405.                           PICTOR User's Guide and Reference
  406.  
  407.  
  408.           Many parts of the library (such as the menu system) simply
  409.           position the hardware text cursor off the screen while the user
  410.           makes selections by moving highlight bars and pressing hotkeys.
  411.  
  412.           The functions and macros for working with the different cursors
  413.           are listed in the following table:
  414.  
  415.           Function       Description
  416.           --------------------------------------------------------------
  417.           getcurs        Returns the current row and column position of the
  418.                          hardware text cursor.
  419.           getcurscol     Returns the current column position of the
  420.                          hardware text cursor.
  421.           getcursrow     Returns the current row position of the hardware
  422.                          text cursor.
  423.           getcurstype    Returns the hardware text cursor's starting and
  424.                          ending scan line values.
  425.           getvcol        Returns the current column position of the
  426.                          screen's logical cursor position.
  427.           getvrow        Returns the current row position of the screen's
  428.                          logical cursor position.
  429.           getwcol        Returns the current column position of the active
  430.                          window pane's logical cursor position.
  431.           getwrow        Returns the current row position of the active
  432.                          window pane's logical cursor position.
  433.           popcurs        Restores the hardware text cursor to the position
  434.                          and type it was prior to the last call to
  435.                          pushcurs.
  436.           pushcurs       Saves the current hardware text cursor position
  437.                          and type so that it can later be restored with
  438.                          popcurs.
  439.           setcurs        Sets the position of the hardware text cursor.
  440.           setcurstype    Sets the starting and ending scan lines of the
  441.                          hardware text cursor.
  442.           setvpos        Sets the screen's logical cursor position.
  443.           setwpos        Sets the active window pane's logical cursor
  444.                          position.
  445.           showcurs       Hides or restores the hardware text cursor.
  446.           synccurs       Sets the position of the hardware text cursor to
  447.                          match the current screen's logical cursor
  448.                          position.
  449.           syncvpos       Sets the screen's logical cursor position to match
  450.                          the current position of the hardware text cursor.
  451.           wsynccurs      Sets the position of the hardware text cursor to
  452.                          match the active window pane's logical cursor
  453.                          position.
  454.  
  455.           All cursor coordinates are 1-based so 1, 1 specifies the top,
  456.           left corner of the cursor's respective region.
  457.  
  458.           Displaying Colors
  459.           The PICTOR library provides complete control over screen colors.
  460.           The following color constants are defined in PICTOR.H:
  461.  
  462.  
  463.  
  464.  
  465.                                           8
  466.                           PICTOR User's Guide and Reference
  467.  
  468.  
  469.                BLACK     BLUE      GREEN     CYAN      RED
  470.                MAGENTA   YELLOW    WHITE     BOLD      BLINKING
  471.  
  472.           PICTOR functions that accept color specifiers require that the
  473.           foreground and background arguments are combined into a single
  474.           color value. The foreback macro can be used to combine foreground
  475.           and background arguments into a value that can be passed to
  476.           PICTOR functions. All of the color constants listed above can be
  477.           used as either foreground or background arguments except for BOLD
  478.           and BLINKING. BOLD and BLINKING are only valid when combined with
  479.           foreground arguments using + or |. For example, the following
  480.           statement uses vcolor to set the current color attribute to bold
  481.           white characters on a blue background.
  482.  
  483.           vcolor(foreback(BOLD+WHITE,BLUE));
  484.  
  485.           In addition, some library functions (such as runmenu and
  486.           messagebox) use several color attributes to display hotkeys and
  487.           highlight bars. These functions take a pointer to a COLORSTRUCT
  488.           structure. This structure contains the following members:
  489.  
  490.                Member              Description
  491.                ----------------------------------------------
  492.                int normal          Normal text.
  493.                int boldnormal      Bold normal text.
  494.                int select          Selected text.
  495.                int boldselect      Bold selected text.
  496.  
  497.           When writing your application, you should remember that some
  498.           users may not use a color display. You can use the getvconfig
  499.           function to determine if the active display supports color and
  500.           set your program's color attributes accordingly.
  501.  
  502.           Creating Menus
  503.           The PICTOR library includes a complete menuing subsystem.
  504.           Incorporating menus into your application requires two steps:
  505.           creating your application's menu data structures, and placing a
  506.           call to runmenu in your application's main loop (or one of the
  507.           main loops).
  508.  
  509.           The menu data structures contain the information that appears in
  510.           the menus and defines which functions will be called if the user
  511.           selects the corresponding menu selection. Optionally, they can
  512.           also contain information to be displayed on the status bar when
  513.           an item is highlighted, and can include a help topic string that
  514.           will be passed to helprun if the user presses <F1> when that item
  515.           is highlighted. Each pulldown submenu is defined as an array of
  516.           SUBMENU structures. This structure contains the following
  517.           members:
  518.  
  519.                Member              Description
  520.                ----------------------------------------------
  521.                char *item          The text that appears as the submenu
  522.                                    selection.
  523.  
  524.  
  525.  
  526.                                           9
  527.                           PICTOR User's Guide and Reference
  528.  
  529.  
  530.                char *description   The text that appears on the status bar
  531.                                    when this selection is highlighted. (Use
  532.                                    NULL for none.)
  533.                char *helptopic     A pointer to a help topic string to be
  534.                                    sent to helprun if the user presses <F1>
  535.                                    when this selection is highlighted.
  536.                void (*function)(void)   A pointer to the function to be
  537.                                    called if the user selects this
  538.                                    selection.
  539.  
  540.           You can use the constant SUBMENU_DIVIDER (defined in PICTOR.H) as
  541.           one or more of the array elements. This constant creates a
  542.           dividing bar that can be used to separate non-related menu items.
  543.           IMPORTANT: The last structure in the array must be the constant
  544.           END_SUBMENU (also defined in PICTOR.H). This constant signifies
  545.           the end of the submenu array.
  546.  
  547.           When you have defined your submenus, you are ready to create the
  548.           mainmenu that references each of those submenus. A mainmenu is
  549.           created with an array of MAINMENU structures. This structure
  550.           contains the following members:
  551.  
  552.                Member              Description
  553.                ---------------------------------------------
  554.                char *item          The text that appears as the menu
  555.                                    selection.
  556.                char *description   The text that appears on the status bar
  557.                                    when this selection is highlighted. (Use
  558.                                    NULL for none.)
  559.                char *helptopic     A pointer to a help topic string to be
  560.                                    sent to helprun if the user presses <F1>
  561.                                    when this selection is highlighted.
  562.                SUBMENU *submenu    A pointer to the submenu (pulldown menu)
  563.                                    to be activated if the user selects this
  564.                                    selection.
  565.  
  566.           IMPORTANT: The last structure in the mainmenu array must be the
  567.           constant END_MAINMENU (also defined in PICTOR.H). This constant
  568.           signifies the end of the mainmenu array.
  569.  
  570.           For both the SUBMENU and MAINMENU structures, the string in the
  571.           item field can contain embedded hotkeys. A hotkey is a bold
  572.           letter within a string that can be used to select the item
  573.           associated with that string. You can embed hotkeys by preceding
  574.           the character you want to be the hotkey with the tilde character
  575.           (~). (Note that the tilde character is not displayed in the
  576.           menu.) Hotkeys in the mainmenu can be used to select a submenu
  577.           (mainmenu hotkeys are used in combination with the Alt key when
  578.           the menu is not active). Hotkeys in the submenu can be used to
  579.           select submenu selections. For example, if one of your submenus
  580.           is called the "File" menu, and you want the first letter (F) to
  581.           be the hotkey, the item string in the MAINMENU structure might
  582.           appear as:
  583.  
  584.  
  585.  
  586.  
  587.                                          10
  588.                           PICTOR User's Guide and Reference
  589.  
  590.  
  591.           "~File"
  592.  
  593.           The main menu function_runmenu_works somewhat like kbdread
  594.           because it returns the keyboard code for the next available
  595.           keystroke. However, if the next keystroke is relevant to the
  596.           current menu, the keystroke is processed by runmenu and runmenu
  597.           returns 0. If runmenu returns the keystroke (a non-zero value),
  598.           your program can process the keystroke. By placing the call to
  599.           runmenu within your program's main loop (or one of its main
  600.           loops), the menu becomes an integrated part of your application.
  601.           In addition, you can use the showmenu function to display a menu
  602.           when your application paints the screen.
  603.  
  604.           To see an example program that shows how to use runmenu, see the
  605.           example for runmenu in the function reference section.
  606.  
  607.           Although the library provides no direct support for adding and
  608.           removing menu selections, it would be easy to implement such a
  609.           feature. Since runmenu takes a pointer to a menu data structure,
  610.           you can simple modify this data. In fact, you could easily create
  611.           an application with context-sensitive menus by defining several
  612.           menus and passing different ones to runmenu at different
  613.           locations in your program.
  614.  
  615.           Creating On-line Help
  616.           This package provides a complete hypertext help system and help
  617.           compiler. Being hypertext means that you can embed links within
  618.           the help text. A link is a reference to another help topic,
  619.           usually displayed with bold attributes. The user can select a
  620.           link to view the topic it references. A help database can be
  621.           built with many links between topics that allows the user to
  622.           easily traverse between related topics.
  623.  
  624.           The first step in creating on-line help is to write the help
  625.           text. The help compiler requires that the text follows a simple
  626.           set of syntax rules so that the compiler can generate the
  627.           required information.
  628.  
  629.           Help compiler directives begin with the '@' character. In this
  630.           version of the help compiler, only two directives are supported:
  631.           @BEGIN and @END. @BEGIN defines the beginning of a help topic and
  632.           is followed on the same line by a label that names the topic. The
  633.           label may be one or more words. The @END directive marks the end
  634.           of a help topic. Compiler directives must always be the first
  635.           non-space characters on the line, and are not case sensitive.
  636.  
  637.           Links are defined by placing text between two vertical bars (|).
  638.           The text should match a @BEGIN label defined elsewhere in the
  639.           help file. The text is not case sensitive but must match
  640.           character for character with the referenced topic label. Note
  641.           that the vertical bar characters are not displayed in the help
  642.           window. Also note that the starting and ending vertical bar must
  643.           be on the same line.
  644.  
  645.  
  646.  
  647.  
  648.                                          11
  649.                           PICTOR User's Guide and Reference
  650.  
  651.  
  652.           Each line outside @BEGIN/@END directives that has a semicolon (;)
  653.           as the first non-space character is considered a comment and is
  654.           ignored by the help compiler. Blank lines outside @BEGIN/@END
  655.           directives are also ignored.
  656.  
  657.           Here is a short example of a help text file:
  658.  
  659.           ;
  660.           ; This line is a comment and is ignored by the help compiler
  661.           ;
  662.  
  663.           @BEGIN Apples
  664.           Apples can be red or green. Like other |Fruit|, apples grow on
  665.           trees.
  666.           @END
  667.  
  668.           @BEGIN Bananas
  669.           Bananas are always yellow unless they are not yet ripe. For
  670.           another tasty fruit, see |Apples|.
  671.           @END
  672.  
  673.           @BEGIN Fruit
  674.           Fruit grows on trees and is usually sweet to the taste. Some
  675.           examples of fruit are |Apples| and |Bananas|.
  676.           @END
  677.  
  678.           This example defines three help topics: "Apples", which contains
  679.           a hypertext link to "Fruit"; "Bananas", which contains a link to
  680.           "Apples"; and "Fruit", which contains links to both "Apples" and
  681.           "Bananas".
  682.  
  683.           The next step is to compile the help text using the help compiler
  684.           (HC.EXE). The help compiler has many warning and error messages
  685.           to help pinpoint any syntax errors in the input file. The
  686.           compiler uses the text compression routines included in the
  687.           PICTOR library. This results in an output file that averages
  688.           about 60% of the size of the input text file. The command line
  689.           syntax for the help compiler is:
  690.  
  691.                HC <inputfile> <outputfile>
  692.  
  693.           Although you can name the files anything you like, we recommend
  694.           giving the input file a .TXT extension, and the output file a
  695.           .HLP extension. Make certain that you never place the input file
  696.           in the <outputfile> field or else your input file could be
  697.           overwritten.
  698.  
  699.           At this point, you have your application's help file and are
  700.           ready to program your application to use it. The first function
  701.           to call is helpopen. This function takes the name of the help
  702.           file, and the colors used to display the help window and help-
  703.           related messages. Note that helpopen doesn't actually open any
  704.           files; it just activates the help system so that helprun can be
  705.           called. helprun takes a string pointer as an argument. The string
  706.  
  707.  
  708.  
  709.                                          12
  710.                           PICTOR User's Guide and Reference
  711.  
  712.  
  713.           should match one of the topic names in your help file. If NULL is
  714.           passed to helpopen, a help index list box is displayed and the
  715.           user can select from any of the topics contained in the help
  716.           file.
  717.  
  718.           You can use the helpsetcontext and helpgetcontext macros to set
  719.           and retrieve the current help context. Although the help context
  720.           has no effect on calls made by your application directly to
  721.           helprun, some PICTOR library routines that take input from the
  722.           user will call the help system if the user presses <F1> and the
  723.           help system has been enabled (by calling helpopen). The help
  724.           topic string that is passed to helprun by these functions is the
  725.           string specified by the help context.
  726.  
  727.           Note that help text is uncompressed "on-the-fly" only for the
  728.           topics viewed by the user. The first time helprun is called,
  729.           several data structures are built. This means that if your
  730.           application only calls helpopen and the user never activates your
  731.           application's help system (that is, helprun is never called), no
  732.           overhead associated with opening the help file or allocating
  733.           memory for the data structures is incurred. You can call
  734.           helpclose to destroy the data objects created by helprun if you
  735.           need to recover the memory for them before your program
  736.           terminates.
  737.  
  738.           For more information on the help functions, and to see an example
  739.           application, refer to the helprun description in the function
  740.           reference section. For a more significant help example, refer to
  741.           the help included with the text editor sample application that is
  742.           included in this package.
  743.  
  744.           Serial Communications
  745.           The PICTOR library provides support for RS-232 asynchronous
  746.           serial communications. The communications routines implement
  747.           interrupt-driven data input (data output is not interrupt-
  748.           driven). Note that this version of the library only supports one
  749.           serial port at one time.
  750.  
  751.           Although there are MS-DOS and ROM BIOS services available for
  752.           serial communications, none of them are interrupt driven. To use
  753.           these services, your program must either continually poll the
  754.           receive status, or risk losing data while your program is
  755.           performing another task. In addition, these services don't
  756.           support the highest baud rates possible on PC's. For these
  757.           reasons, the PICTOR communications routines by-pass the MS-DOS
  758.           and ROM-BIOS services altogether and program the hardware
  759.           directly.
  760.  
  761.           The comopen function is used to prepare the serial port for input
  762.           and output. All other communications functions return an error if
  763.           comopen has not been called. Specifically, comopen does the
  764.           following:
  765.  
  766.  
  767.  
  768.  
  769.  
  770.                                          13
  771.                           PICTOR User's Guide and Reference
  772.  
  773.  
  774.                   * Configures the serial port according to the port
  775.                     number, baud rate, parity, data bits, stop bits, and
  776.                     IRQ (interrupt request) values that you supply.
  777.  
  778.                   * Installs an interrupt handler for receiving data. The
  779.                     handler places the data received in an internal
  780.                     circular buffer where it remains until one of the
  781.                     communications functions is called to retrieve it.
  782.  
  783.                   * Installs an interrupt handler for the system timer.
  784.                     This handler is used for detecting time-out conditions.
  785.  
  786.           The other communications routines are:
  787.  
  788.                     Function  Description
  789.                     -----------------------------------------------------
  790.                     comclose  Uninstalls the interrupt handlers installed
  791.                               by comopen.
  792.                     comflush  Clears any characters waiting in the receive
  793.                               buffer.
  794.                     comgetc   Reads a single character from the serial
  795.                               port.
  796.                     comgets   Reads a '\r'-terminated string from the
  797.                               serial port.
  798.                     comloc    Returns the number of characters waiting in
  799.                               the receive buffer.
  800.                     computc   Writes a character to the serial port.
  801.                     computs   Writes a null-terminated string to the serial
  802.                               port.
  803.                     comread   Reads the specified number of characters from
  804.                               the serial port.
  805.                     comwrite  Writes the specified number of characters to
  806.                               the serial port.
  807.  
  808.           In addition, the comsettimeout and comgettimeout macros can be
  809.           used to set and retrieve the time-out value. The time-out value
  810.           specifies the amount of time allowed between characters before a
  811.           time-out condition is generated.
  812.  
  813.           See the function reference section for a detailed description of
  814.           each of the communications functions.
  815.  
  816.           Additional Information
  817.           This section has described how to use some of the key features of
  818.           the PICTOR library. We recommend that you browse through the
  819.           function reference section if you haven't done so already.
  820.           Reading the function descriptions will give you an idea of the
  821.           features available in this package. In addition, many function
  822.           descriptions include example programs. These example programs are
  823.           also on the distribution disk(s) for you to compile and modify.
  824.  
  825.           The distribution disk(s) also includes Ed, a text editor program.
  826.           All the source code is included. Ed makes use of many of the
  827.           features of the PICTOR library. In addition, you can review the
  828.  
  829.  
  830.  
  831.                                          14
  832.                           PICTOR User's Guide and Reference
  833.  
  834.  
  835.           source code to see an implementation of a text editor and,
  836.           perhaps, customize it to suit your needs. Ed is missing many
  837.           features that would be required of a commercial text editor
  838.           program, but it has a strong foundation from which a more
  839.           professional text editor could be built. Refer to the file
  840.           README.DOC for additional information about working with the
  841.           editor source code.
  842.  
  843.           Technical Assistance
  844.           As a free program, we cannot provide technical support for this
  845.           product. However, you may write to us at the address below if you
  846.           have any comments or questions. We will try to respond to all
  847.           correspondence.
  848.  
  849.           If you would like a printed manual, with table of contents and
  850.           index, for the Pictor library, send $9.00 + $1.50 shipping to:
  851.  
  852.                SoftCircuits Programming
  853.                P.O. Box 16262
  854.                Irvine, CA 92713
  855.  
  856.  
  857.           FUNCTIONS
  858.           ----------------------------------------------------------------
  859.           This section provides a complete reference for all of the PICTOR
  860.           library functions and macros in alphabetical order. There are
  861.           several items that describe each function. The meaning of each
  862.           item is as follows:
  863.  
  864.           Item           Meaning
  865.           -------------------------------------------------------------
  866.           Syntax         Shows the data types received and returned by the
  867.                          function or macro.
  868.           Include        Shows the include file that contains the prototype
  869.                          for the function or the definition for the macro.
  870.                          The include file also defines any constants or
  871.                          structures that are associated with the function.
  872.           Description    Gives a description of the function or macro.
  873.           Returns        Describes the return value, if any.
  874.           See also       Lists other functions or macros that are similar
  875.                          to, or are usually used with, the function.
  876.           Example        Some function descriptions give an example program
  877.                          that shows how to use the function. Example
  878.                          programs are complete programs that can be
  879.                          compiled and run. All example programs are on the
  880.                          distribution disk(s). Note that all the example
  881.                          programs place angle brackets (< >) around
  882.                          included header files. This assumes that you
  883.                          placed the included header files in your
  884.                          compiler's include directory.
  885.  
  886.  
  887.                          beep
  888.                          ---------------------------------------------
  889.  
  890.  
  891.  
  892.                                          15
  893.                           PICTOR User's Guide and Reference
  894.  
  895.  
  896.           Syntax         void beep(void);
  897.  
  898.           Include        pictor.h
  899.  
  900.           Description    This function sounds the computer's internal
  901.                          speaker. beep provides a standard way to alert the
  902.                          user by making a sound with the same frequency and
  903.                          duration as is produced by many PICTOR library
  904.                          routines (such as messagebox and editbox). Using
  905.                          the beep function to alert the user has an
  906.                          additional advantage because error beeps can then
  907.                          be disabled globally using seterrorbeep.
  908.  
  909.                          Note that the beep function flushes the keyboard
  910.                          buffer to prevent keyboard overrun.
  911.  
  912.           See also       seterrorbeep, tone
  913.  
  914.  
  915.                          center
  916.                          ---------------------------------------------
  917.           Syntax         int center(int inside, int outside);
  918.  
  919.           Include        pictor.h
  920.  
  921.           Description    This macro calculates the starting position so
  922.                          that an item with inside length is centered inside
  923.                          an item with outside length. The lengths can refer
  924.                          to either width or height. If inside is larger
  925.                          than outside, the result is undefined.
  926.  
  927.           Returns        The centered starting position as described above.
  928.  
  929.           Example
  930.  
  931.                /*
  932.                ** CENTER.C: Displays a message centered on the screen.
  933.                */
  934.                #include <string.h>
  935.                #include <pictor.h>
  936.  
  937.                char *msg = "Hello, from the PICTOR library!";
  938.  
  939.                void main()
  940.                {
  941.                   VIDEOSTRUCT vstruct;
  942.  
  943.                   /* initialize library */
  944.                   initvideo();
  945.                   getvconfig(&vstruct);
  946.  
  947.                   vcolor(foreback(BOLD+WHITE,BLUE));
  948.                   cls();
  949.  
  950.  
  951.  
  952.  
  953.                                          16
  954.                           PICTOR User's Guide and Reference
  955.  
  956.  
  957.                   setvpos(center(1,vstruct.rows),
  958.                      center(strlen(msg),vstruct.columns));
  959.                   vputs(msg);
  960.                   kbdread();
  961.  
  962.                   /* restore screen */
  963.                   vcolor(foreback(WHITE,BLACK));
  964.                   cls();
  965.                }
  966.  
  967.                          cleareol
  968.                          ---------------------------------------------
  969.           Syntax         void cleareol(void);
  970.  
  971.           Include        pictor.h
  972.  
  973.           Description    The cleareol function clears from the current
  974.                          logical cursor position to the end of the line.
  975.                          The logical cursor position is updated to point to
  976.                          the start of the next line.
  977.  
  978.           See also       wcleareol
  979.  
  980.  
  981.                          clrstatus
  982.                          ---------------------------------------------
  983.           Syntax         void clrstatus(void);
  984.  
  985.           Include        pictor.h
  986.  
  987.           Description    The clrstatus function clears the status bar.
  988.  
  989.           See also       initstatus, statusbar
  990.  
  991.  
  992.                          cls
  993.                          ---------------------------------------------
  994.           Syntax         void cls(void);
  995.  
  996.           Include        pictor.h
  997.  
  998.           Description    This function clears the entire screen and
  999.                          positions both the logical and the hardware text
  1000.                          cursor at the top, left corner of the screen.
  1001.  
  1002.  
  1003.                          comclose
  1004.                          ---------------------------------------------
  1005.           Syntax         int comclose(void)
  1006.  
  1007.           Include        comlib.h
  1008.  
  1009.           Description    This function closes the communications port that
  1010.                          was previously opened using comopen. Since comopen
  1011.  
  1012.  
  1013.  
  1014.                                          17
  1015.                           PICTOR User's Guide and Reference
  1016.  
  1017.  
  1018.                          registers comclose with the ANSI C library routine
  1019.                          atexit, you do not need to call this function.
  1020.                          atexit will call comclose upon normal program
  1021.                          termination. You may want to call comclose to
  1022.                          close the communications port before your program
  1023.                          terminates or to reopen the communications port
  1024.                          with a different configuration. There is no ill-
  1025.                          effect from calling comclose multiple times.
  1026.  
  1027.           Returns        0 if successful or -1 if an error occurred.
  1028.  
  1029.           See also       comopen
  1030.  
  1031.  
  1032.                          comflush
  1033.                          ---------------------------------------------
  1034.           Syntax         int comflush(void);
  1035.  
  1036.           Include        comlib.h
  1037.  
  1038.           Description    Clears any characters waiting in the receive
  1039.                          buffer for the communications port previously
  1040.                          opened using comopen.
  1041.  
  1042.           Returns        The number of characters that were in the buffer
  1043.                          before it was flushed.
  1044.  
  1045.           See also       comloc, comopen
  1046.  
  1047.  
  1048.                          comgetc
  1049.                          ---------------------------------------------
  1050.           Syntax         int comgetc(char *cptr);
  1051.  
  1052.           Include        comlib.h
  1053.  
  1054.           Description    Gets the next available byte from the
  1055.                          communication port previously opened using
  1056.                          comopen. The byte is written to the character
  1057.                          pointed to by cptr.
  1058.  
  1059.           Returns        0 if successful or -1 if an error occurred.
  1060.  
  1061.           See also       comloc, comopen, computc, comsettimeout
  1062.  
  1063.  
  1064.                          comgets
  1065.                          ---------------------------------------------
  1066.           Syntax         int comgets(char *buffer, int maxlen);
  1067.  
  1068.           Include        comlib.h
  1069.  
  1070.           Description    Reads a string from the communications port
  1071.                          previously opened using comopen. Characters are
  1072.  
  1073.  
  1074.  
  1075.                                          18
  1076.                           PICTOR User's Guide and Reference
  1077.  
  1078.  
  1079.                          read from the serial port and copied to buffer
  1080.                          until a carriage return ('\r') is copied or until
  1081.                          maxlen characters have been copied. A null-
  1082.                          terminator ('\0') is then appended to buffer.
  1083.                          buffer should be big enough to hold maxlen + 1
  1084.                          characters. If you need to receive data that may
  1085.                          include embedded carriage returns ('\r'), see the
  1086.                          comread function.
  1087.  
  1088.                          If an error occurs, buffer contains a null-
  1089.                          terminated string with the characters that had
  1090.                          been received prior to the error.
  1091.  
  1092.           Returns        0 if successful or -1 if an error occurred.
  1093.  
  1094.           See also       comloc, comopen, computs, comread, comsettimeout
  1095.  
  1096.  
  1097.                          comloc
  1098.                          ---------------------------------------------
  1099.           Syntax         int comloc(void);
  1100.  
  1101.           Include        comlib.h
  1102.  
  1103.           Description    The comloc function returns the number of
  1104.                          characters waiting in the receive buffer for the
  1105.                          communications port previously opened using
  1106.                          comopen.
  1107.  
  1108.           Returns        The number of characters waiting in the receive
  1109.                          buffer.
  1110.  
  1111.           See also       comflush, comopen
  1112.  
  1113.  
  1114.                          comopen
  1115.                          ---------------------------------------------
  1116.           Syntax         int comopen(int comport, int baudrate, int parity,
  1117.                               int databits, int stopbits, int irq);
  1118.  
  1119.           Include        comlib.h
  1120.  
  1121.           Description    Configures the specified communications port based
  1122.                          on the given arguments. The constants (defined in
  1123.                          PICTOR.H) allowed for each argument field are
  1124.                          described below:
  1125.  
  1126.                          Field          Constant       Meaning
  1127.                          ---------------------------------------------
  1128.                          comport        CO_COM1        COM1
  1129.                                         CO_COM2        COM2
  1130.                                         CO_COM3        COM3
  1131.                                         CO_COM4        COM4
  1132.                          baudrate       CO_BAUD300     300 baud
  1133.  
  1134.  
  1135.  
  1136.                                          19
  1137.                           PICTOR User's Guide and Reference
  1138.  
  1139.  
  1140.                                         CO_BAUD1200    1200 baud
  1141.                                         CO_BAUD2400    2400 baud
  1142.                                         CO_BAUD4800    4800 baud
  1143.                                         CO_BAUD9600    9600 baud
  1144.                                         CO_BAUD19200   19200 baud
  1145.                                         CO_BAUD38400   38400 baud
  1146.                                         CO_BAUD57600   57600 baud
  1147.                                         CO_BAUD115200  115200 baud
  1148.                          parity         CO_NOPARITY    No parity
  1149.                                         CO_ODDPARITY   Odd parity
  1150.                                         CO_EVENPARITY  Even parity
  1151.                          databits       CO_DATA7       7 data bits
  1152.                                         CO_DATA8       8 data bits
  1153.                          stopbits       CO_STOP1       1 stop bit
  1154.                                         CO_STOP2       2 stop bits
  1155.                          irq            CO_IRQDEFAULT  Standard IRQ4 for
  1156.                                                        COM 1 and 3, IRQ3
  1157.                                                        for COM 2 and 4.
  1158.                                         CO_IRQ2   IRQ2
  1159.                                         CO_IRQ3   IRQ3
  1160.                                         CO_IRQ4   IRQ4
  1161.                                         CO_IRQ5   IRQ5
  1162.  
  1163.                          The I/O address for the specified RS-232 adapter
  1164.                          is read from the ROM BIOS data area. If the value
  1165.                          read is 0, the specified communications port is
  1166.                          considered invalid and comopen returns an error.
  1167.  
  1168.                          When comopen is called for the first time, it
  1169.                          registers comclose with the ANSI C library
  1170.                          function atexit. atexit will automatically call
  1171.                          comclose upon normal program termination.
  1172.  
  1173.                          Note: The comopen function traps interrupt 0x1C.
  1174.                          installclock also traps interrupt 0x1C. If you are
  1175.                          using both functions and you need to manually
  1176.                          remove or close either one, they must be
  1177.                          uninstalled in the reverse order that they were
  1178.                          installed.
  1179.  
  1180.           Returns        0 if successful or -1 if an error occurred.
  1181.  
  1182.           See also       comclose, comsettimeout
  1183.  
  1184.  
  1185.                          compress
  1186.                          ---------------------------------------------
  1187.           Syntax         WORD compress(BYTE *inbuff, WORD len,
  1188.                               BYTE *outbuff, NODE *rootnode);
  1189.  
  1190.           Include        compress.h
  1191.  
  1192.           Description    Compresses an array of characters using the
  1193.                          huffman compression algorithm. inbuff is a pointer
  1194.  
  1195.  
  1196.  
  1197.                                          20
  1198.                           PICTOR User's Guide and Reference
  1199.  
  1200.  
  1201.                          to a buffer with the characters to be compressed.
  1202.                          len is the number of characters in inbuff. outbuff
  1203.                          is where the compressed data will be written.
  1204.                          rootnode is the root node to a compression code
  1205.                          tree created with gettree.
  1206.  
  1207.                          The huffman compression algorithm takes advantage
  1208.                          of the fact that some characters are used more
  1209.                          frequently than others. The more frequently a
  1210.                          character is used, the fewer the number of bits
  1211.                          that are used to represent that character.
  1212.                          Therefore, compress is most effective when
  1213.                          compressing straight text files and is not
  1214.                          recommended for compressing binary data.
  1215.  
  1216.                          Note that although this compression algorithm
  1217.                          offers significant compression, if your file is
  1218.                          compressed in multiple segments, it is possible
  1219.                          for the compressed data to be larger than the
  1220.                          original data in one or more of those segments.
  1221.                          For this reason, outbuff should be larger than len
  1222.                          bytes under most conditions. Also note that all
  1223.                          characters in inbuff must have been included in
  1224.                          the file stream passed to gettree when the code
  1225.                          tree was created or compress will fail.
  1226.  
  1227.           Returns        The number of bytes written to outbuff (the
  1228.                          compressed length).
  1229.  
  1230.           See also       freetree, gettree, readtree, uncompress, writetree
  1231.  
  1232.           Example
  1233.  
  1234.                /*
  1235.                ** COMPRESS.C: Compresses a text file. Use UNCOMP.C to
  1236.                ** restore to original form.
  1237.                */
  1238.  
  1239.                #include <stdio.h>
  1240.                #include <string.h>
  1241.                #include <compress.h>
  1242.  
  1243.                BYTE inbuff[BUFSIZ];
  1244.                BYTE outbuff[BUFSIZ + 200];
  1245.  
  1246.                void main(int argc,char *argv[])
  1247.                {
  1248.                   FILE *istream,*ostream;
  1249.                   WORD complen,uncomplen;
  1250.                   NODE *rootnode;
  1251.  
  1252.                   /* check arguments */
  1253.                   if(argc != 3 || !stricmp(argv[1],argv[2])) {
  1254.                      printf("Usage:\tCOMPRESS <infile> <outfile>\n");
  1255.  
  1256.  
  1257.  
  1258.                                          21
  1259.                           PICTOR User's Guide and Reference
  1260.  
  1261.  
  1262.                      return;
  1263.                   }
  1264.  
  1265.                   /* open files */
  1266.                   istream = fopen(argv[1],"rt");
  1267.                   ostream = fopen(argv[2],"wb");
  1268.                   if(istream == NULL || ostream == NULL) {
  1269.                      printf("File error\n");
  1270.                      return;
  1271.                   }
  1272.  
  1273.                   /* build compression code tree */
  1274.                   rootnode = gettree(istream);
  1275.                   if(rootnode == NULL) {
  1276.                      printf("Out of memory\n");
  1277.                      return;
  1278.                   }
  1279.  
  1280.                   /* set file pointer back to beginning of file */
  1281.                   rewind(istream);
  1282.  
  1283.                   /* write compressed code tree to file */
  1284.                   complen = writetree(rootnode,outbuff);
  1285.                   putw(complen,ostream);
  1286.                   fwrite(outbuff,sizeof(BYTE),complen,ostream);
  1287.  
  1288.                   /* compress data and write to output file */
  1289.                   do {
  1290.                      uncomplen = fread(inbuff,sizeof(BYTE),BUFSIZ,
  1291.                         istream);
  1292.                      complen = compress(inbuff,uncomplen,outbuff,
  1293.                         rootnode);
  1294.                      putw(uncomplen,ostream);
  1295.                      putw(complen,ostream);
  1296.                      fwrite(outbuff,sizeof(BYTE),complen,ostream);
  1297.                   } while(uncomplen == BUFSIZ);
  1298.  
  1299.                   /* indicate end of file */
  1300.                   putw(0x00,ostream);
  1301.  
  1302.                   fclose(istream);
  1303.                   fclose(ostream);
  1304.                }
  1305.  
  1306.  
  1307.                          computc
  1308.                          ---------------------------------------------
  1309.           Syntax         int computc(char c);
  1310.  
  1311.           Include        comlib.h
  1312.  
  1313.           Description    Writes a single character to the communications
  1314.                          port previously opened using comopen.
  1315.  
  1316.  
  1317.  
  1318.  
  1319.                                          22
  1320.                           PICTOR User's Guide and Reference
  1321.  
  1322.  
  1323.           Returns        0 if successful or -1 if an error occurred.
  1324.  
  1325.           See also       comgetc, comopen, comsettimeout
  1326.  
  1327.  
  1328.                          computs
  1329.                          ---------------------------------------------
  1330.           Syntax         int computs(char *string);
  1331.  
  1332.           Include        comlib.h
  1333.  
  1334.           Description    Writes a null-terminated string to the
  1335.                          communications port previously opened using
  1336.                          comopen. The null-terminator is not written. If
  1337.                          you need to send data that contains embedded null
  1338.                          characters ('\0'), use the comwrite function.
  1339.  
  1340.           Returns        0 of successful or -1 if an error occurred.
  1341.  
  1342.           See also       comgets, comopen, comsettimeout, comwrite
  1343.  
  1344.  
  1345.                          comread
  1346.                          ---------------------------------------------
  1347.           Syntax         int comread(char *buffer, int count);
  1348.  
  1349.           Include        comlib.h
  1350.  
  1351.           Description    Copies count bytes to buffer from the
  1352.                          communications port previously opened using
  1353.                          comopen.
  1354.  
  1355.           Returns        0 if successful or -1 if an error occurred.
  1356.  
  1357.           See also       comloc, comopen, comwrite, comsettimeout
  1358.  
  1359.  
  1360.                          comgettimeout, comsettimeout
  1361.                          ---------------------------------------------
  1362.           Syntax         int comgettimeout(void);
  1363.                          void comsettimeout(int timeout);
  1364.  
  1365.           Include        comlib.h
  1366.  
  1367.           Description    These macros get and set the time-out value used
  1368.                          by the serial communications functions. Many of
  1369.                          these functions return an error condition if a
  1370.                          time-out occurs while trying to send or receive a
  1371.                          character across the serial port.
  1372.  
  1373.                          The time-out value defines the number of 18ths of
  1374.                          a second allowed between each character
  1375.                          transmitted or received before a time-out
  1376.                          condition is generated.
  1377.  
  1378.  
  1379.  
  1380.                                          23
  1381.                           PICTOR User's Guide and Reference
  1382.  
  1383.  
  1384.  
  1385.           Returns        comgettimeout returns the current time-out value.
  1386.  
  1387.  
  1388.                          comwrite
  1389.                          ---------------------------------------------
  1390.           Syntax         int comwrite(char *buffer, int count);
  1391.  
  1392.           Include        comlib.h
  1393.  
  1394.           Description    Copies count bytes from buffer to the
  1395.                          communications port previously opened using
  1396.                          comopen.
  1397.  
  1398.           Returns        0 if successful or -1 if an error occurred.
  1399.  
  1400.           See also       comopen, comread, comsettimeout
  1401.  
  1402.  
  1403.                          _CURR_WPANE
  1404.                          ---------------------------------------------
  1405.           Include        pictor.h
  1406.  
  1407.           Description    The _CURR_WPANE macro is equal to the active
  1408.                          window pane. You can use the macro as a structure;
  1409.                          it is not a pointer. The effects of this macro are
  1410.                          undefined if there is no active window pane.
  1411.  
  1412.                          This macro is designed to only be used internally
  1413.                          by PICTOR library functions but is documented here
  1414.                          in case you need it.
  1415.  
  1416.  
  1417.                          editbox
  1418.                          ---------------------------------------------
  1419.           Syntax         int editbox(char *prompt, char *buffer,
  1420.                               int maxlen, char *title,
  1421.                               COLORSTRUCT *colors);
  1422.  
  1423.           Include        pictor.h
  1424.  
  1425.           Description    The editbox function creates a window with the
  1426.                          given prompt, and calls kbdedit to edit a string.
  1427.                          buffer is where the edited text will be stored and
  1428.                          maxlen is the maximum number of characters
  1429.                          allowed. title is the title given to the window
  1430.                          (use NULL for no title). colors is a pointer to a
  1431.                          COLORSTRUCT structure that contains the colors
  1432.                          used to display the window.
  1433.  
  1434.           Returns        TRUE if the user pressed <Enter>, or FALSE if the
  1435.                          user pressed <Escape>. If the user pressed
  1436.                          <Escape>, the contents of buffer are not modified.
  1437.  
  1438.  
  1439.  
  1440.  
  1441.                                          24
  1442.                           PICTOR User's Guide and Reference
  1443.  
  1444.  
  1445.  
  1446.                          escpressed
  1447.                          ---------------------------------------------
  1448.           Syntax         int escpressed(void);
  1449.  
  1450.           Include        pictor.h
  1451.  
  1452.           Description    The escpressed macro determines if the last key
  1453.                          returned by kbdread was the <Escape> key. This
  1454.                          macro is useful with some library functions such
  1455.                          as messagebox for determining if the function
  1456.                          ended in response to the user pressing <Escape>.
  1457.  
  1458.           Returns        TRUE if the last keystroke returned by kbdread was
  1459.                          the <Escape> key, FALSE otherwise.
  1460.  
  1461.  
  1462.                          foreback
  1463.                          ---------------------------------------------
  1464.           Syntax         int foreback(int foreground, int background);
  1465.  
  1466.           Include        pictor.h
  1467.  
  1468.           Description    The foreback macro combines foreground and
  1469.                          background into a single color attribute value.
  1470.                          Since PICTOR library functions that take color
  1471.                          arguments require a single color integer, foreback
  1472.                          can be used as an argument to those functions.
  1473.  
  1474.           Returns        The combined color attribute as described above.
  1475.  
  1476.           See also       vcolor
  1477.  
  1478.           Example        For an example of foreback, please see the helprun
  1479.                          example.
  1480.  
  1481.  
  1482.                          frame
  1483.                          ---------------------------------------------
  1484.           Syntax         void frame(int top, int left, int height,
  1485.                               int width);
  1486.  
  1487.           Include        pictor.h
  1488.  
  1489.           Description    This function draws a box using the current frame
  1490.                          type.
  1491.  
  1492.           See also       setframe
  1493.  
  1494.  
  1495.                          freetree
  1496.                          ---------------------------------------------
  1497.           Syntax         void freetree(NODE *rootnode);
  1498.  
  1499.  
  1500.  
  1501.  
  1502.                                          25
  1503.                           PICTOR User's Guide and Reference
  1504.  
  1505.  
  1506.           Include        compress.h
  1507.  
  1508.           Description    This function frees the memory for a compression
  1509.                          code tree created with gettree or readtree.
  1510.                          rootnode is a pointer to the tree's root node.
  1511.                          This function is provided because simply passing a
  1512.                          root node to the free function does not release
  1513.                          all of the memory in the tree.
  1514.  
  1515.           See also       compress, gettree, readtree, uncompress, writetree
  1516.  
  1517.  
  1518.                          getaltkey
  1519.                          ---------------------------------------------
  1520.           Syntax         int getaltkey(int c);
  1521.  
  1522.           Include        pictor.h
  1523.  
  1524.           Description    Converts the ASCII character c into its Alt-key
  1525.                          equivalent. For example, if c is 'A' or 'a',
  1526.                          getaltkey returns the key code for ALT_A which is
  1527.                          defined in PICTOR.H.
  1528.  
  1529.           Returns        The Alt-key equivalent of c, or 0 if c is not
  1530.                          alpha-numeric.
  1531.  
  1532.           See also       gethotkey
  1533.  
  1534.  
  1535.                          getcurs, getcurscol, getcursrow
  1536.                          ---------------------------------------------
  1537.           Syntax         int getcurs(void);
  1538.                          int getcurscol(void);
  1539.                          int getcursrow(void);
  1540.  
  1541.           Include        pictor.h
  1542.  
  1543.           Description    The getcurs routines return the current location
  1544.                          of the hardware text cursor. getcurs returns the
  1545.                          location as a single integer value. The high byte
  1546.                          contains the cursor's row coordinate; the low byte
  1547.                          contains the cursor's column coordinate. The
  1548.                          getcursrow and getcurscol macros return the row
  1549.                          and column coordinates separately.
  1550.  
  1551.           Returns        The cursor location as described above.
  1552.  
  1553.           See also       getvcol, getvrow, setcurs
  1554.  
  1555.  
  1556.                          getcurstype
  1557.                          ---------------------------------------------
  1558.           Syntax         int getcurstype(void);
  1559.  
  1560.  
  1561.  
  1562.  
  1563.                                          26
  1564.                           PICTOR User's Guide and Reference
  1565.  
  1566.  
  1567.           Include        pictor.h
  1568.  
  1569.           Description    This function returns the starting and ending scan
  1570.                          lines of the current hardware text cursor. The
  1571.                          high byte of the return value contains the
  1572.                          cursor's starting scan line, and the low byte
  1573.                          contains the ending scan line.
  1574.  
  1575.           Returns        The current cursor type as described above.
  1576.  
  1577.           See also       setcurstype
  1578.  
  1579.  
  1580.                          gethotkey
  1581.                          ---------------------------------------------
  1582.           Syntax         int gethotkey(char *string);
  1583.  
  1584.           Include        pictor.h
  1585.  
  1586.           Description    This function returns the first character in
  1587.                          string that would be printed bold by hputs. This
  1588.                          is the character that follows the first tilde (~)
  1589.                          character.
  1590.  
  1591.           Returns        The first character in string following the first
  1592.                          tilde character or 0 if string contains no such
  1593.                          character.
  1594.  
  1595.           See also       getaltkey, hputs
  1596.  
  1597.  
  1598.                          getscrn
  1599.                          ---------------------------------------------
  1600.           Syntax         void getscrn(int *buffer, int top, int left,
  1601.                               int height, int width);
  1602.  
  1603.           Include        pictor.h
  1604.  
  1605.           Description    Copies the data from the region of the screen
  1606.                          specified by the last 4 arguments to buffer.
  1607.                          getscrn is used to save the screen before opening
  1608.                          a window. The window can then be closed by using
  1609.                          putscrn to write the original data back to the
  1610.                          screen. Since getscrn is called automatically by
  1611.                          wopen, you'll only need to call this function if
  1612.                          you are writing custom windowing routines.
  1613.  
  1614.                          The size of buffer should be ((height * width) *
  1615.                          sizeof(int)).
  1616.  
  1617.           See also       putscrn
  1618.  
  1619.  
  1620.                          gettree
  1621.  
  1622.  
  1623.  
  1624.                                          27
  1625.                           PICTOR User's Guide and Reference
  1626.  
  1627.  
  1628.                          ---------------------------------------------
  1629.           Syntax         NODE *gettree(FILE *stream);
  1630.  
  1631.           Include        compress.h
  1632.  
  1633.           Description    Builds a compression code tree for the characters
  1634.                          in stream and returns a pointer to the root node.
  1635.                          Since the compression routines are unable to
  1636.                          process blocks of data larger than 64k, and the
  1637.                          code tree must include all of the characters to be
  1638.                          compressed, this function takes a FILE pointer as
  1639.                          its argument (as opposed to a buffer pointer).
  1640.                          Characters are read from stream starting from the
  1641.                          current file position and continuing until the end
  1642.                          of file, or until an error occurs. Note that
  1643.                          stream remains open and the file position
  1644.                          associated with stream points past the last
  1645.                          character read when gettree returns.
  1646.  
  1647.           Returns        A pointer to the root node or NULL if there was
  1648.                          not enough memory to create the tree.
  1649.  
  1650.           See also       compress, freetree, readtree, uncompress,
  1651.                          writetree
  1652.  
  1653.           Example        For an example of gettree, please see the compress
  1654.                          example.
  1655.  
  1656.  
  1657.                          getvcol, getvrow
  1658.                          ---------------------------------------------
  1659.           Syntax         int getvcol(void)
  1660.                          int getvrow(void)
  1661.  
  1662.           Include        pictor.h
  1663.  
  1664.           Description    These two macros return the current logical screen
  1665.                          position used by PICTOR library routines.
  1666.  
  1667.           Returns        The current logical screen position as described
  1668.                          above.
  1669.  
  1670.           See also       getcurs, getwcol, getwrow, setvpos
  1671.  
  1672.  
  1673.                          getvconfig
  1674.                          ---------------------------------------------
  1675.           Syntax         void getvconfig(VIDEOSTRUCT *vstruct);
  1676.  
  1677.           Include        pictor.h
  1678.  
  1679.           Description    This function fills vstruct with information that
  1680.                          reflects the display configuration at the time of
  1681.                          the last call to initvideo. initvideo must have
  1682.  
  1683.  
  1684.  
  1685.                                          28
  1686.                           PICTOR User's Guide and Reference
  1687.  
  1688.  
  1689.                          been previously called in order for getvconfig to
  1690.                          return meaningful values.
  1691.  
  1692.                          The VIDEOSTRUCT structure contains the following
  1693.                          members:
  1694.  
  1695.                          Member            Description
  1696.                          --------------------------------------------------
  1697.                          unsigned segment  The display segment address.
  1698.                                            Will be one of the constants
  1699.                                            COLOR_SEG or MONO_SEG, which are
  1700.                                            defined in PICTOR.H.
  1701.                          int snowcheck     TRUE if snow checking is
  1702.                                            enabled, FALSE otherwise. (See
  1703.                                            the snowcheckoff macro for a
  1704.                                            description of snow checking.)
  1705.                          int rows          The number of text rows on the
  1706.                                            display.
  1707.                          int columns       The number of text columns on
  1708.                                            the display.
  1709.                          int mode          The video mode.
  1710.                          int page          The active video page.
  1711.                          int colorsupport  TRUE if the display adapter
  1712.                                            supports color, FALSE otherwise.
  1713.                                            Note that some systems may have
  1714.                                            a color adapter with a non-color
  1715.                                            display (such as composite
  1716.                                            monitors and some LCD's). For
  1717.                                            this reason, many applications
  1718.                                            allow the user to specify that
  1719.                                            only black and white attributes
  1720.                                            be used.
  1721.  
  1722.           See also       initvideo
  1723.  
  1724.           Example        For an example of getvconfig, please see the
  1725.                          xprintf example.
  1726.  
  1727.  
  1728.                          getwcol, getwrow
  1729.                          ---------------------------------------------
  1730.           Syntax         int getwcol(void);
  1731.                          int getwrow(void);
  1732.  
  1733.           Include        pictor.h
  1734.  
  1735.           Description    The getwcol and getwrow functions return the
  1736.                          current column and row position of the active
  1737.                          window pane.
  1738.  
  1739.           Returns        The current position of the active window pane as
  1740.                          described above. If there is no active window
  1741.                          pane, both functions return 1.
  1742.  
  1743.  
  1744.  
  1745.  
  1746.                                          29
  1747.                           PICTOR User's Guide and Reference
  1748.  
  1749.  
  1750.           See also       getvcol, getvrow, setwpos
  1751.  
  1752.  
  1753.                          getwcols, getwrows
  1754.                          ---------------------------------------------
  1755.           Syntax         int getwcols(void);
  1756.                          int getwrows(void);
  1757.  
  1758.           Include        pictor.h
  1759.  
  1760.           Description    The getwcols and getwrows macros return the number
  1761.                          of columns and rows in the active window pane. The
  1762.                          values returned are the number of columns or rows
  1763.                          inside the window pane not counting the window
  1764.                          frame or pane border.
  1765.  
  1766.           Returns        The number of columns or rows in the active window
  1767.                          pane. The return values are undefined if there is
  1768.                          no active window pane.
  1769.  
  1770.           See also       getwcol, getwrow
  1771.  
  1772.  
  1773.                          helpclose
  1774.                          ---------------------------------------------
  1775.           Syntax         void helpclose(void);
  1776.  
  1777.           Include        pictor.h
  1778.  
  1779.           Description    This function destroys all data objects associated
  1780.                          with the current help file, frees the memory used
  1781.                          for those data objects and disables the help
  1782.                          system. Since MS-DOS automatically reclaims any
  1783.                          memory allocated by your application when the
  1784.                          application terminates, you do not need to call
  1785.                          this function. However, you can call this function
  1786.                          if you need to recover memory allocated by the
  1787.                          help system before your application terminates.
  1788.  
  1789.           See also       helpopen, helprun
  1790.  
  1791.  
  1792.                          helpopen
  1793.                          ---------------------------------------------
  1794.           Syntax         void helpopen(char *filename,
  1795.                               COLORSTRUCT *hlpcolors,
  1796.                               COLORSTRUCT *msgcolors);
  1797.  
  1798.           Include        pictor.h
  1799.  
  1800.           Description    This function specifies the filename and color
  1801.                          attributes to be used by the help system when
  1802.                          helprun is called. In effect, helpopen activates
  1803.                          the help system. filename specifies the name of
  1804.  
  1805.  
  1806.  
  1807.                                          30
  1808.                           PICTOR User's Guide and Reference
  1809.  
  1810.  
  1811.                          the help file. The help file must be compatible
  1812.                          with the format created by the help compiler
  1813.                          included with the PICTOR tool kit. hlpcolors
  1814.                          points to a COLORSTRUCT structure that contains
  1815.                          the colors to be used to display the help screen.
  1816.                          msgcolors points to a COLORSTRUCT structure that
  1817.                          contains the colors to be used to display the help
  1818.                          index and any help messages that must be
  1819.                          displayed.
  1820.  
  1821.                          If helpopen is called after help has already been
  1822.                          enabled, helpopen begins by calling helpclose to
  1823.                          destroy any data objects associated with the
  1824.                          previous help file. It should be pointed out that
  1825.                          helpopen doesn't actually open any files. The help
  1826.                          file is not accessed until helprun is called and
  1827.                          helprun never lets any files remain open between
  1828.                          calls.
  1829.  
  1830.           See also       helpclose, helprun
  1831.  
  1832.           Example        For an example of helpopen, please see the helprun
  1833.                          example.
  1834.  
  1835.  
  1836.                          helpgetcontext, helpsetcontext
  1837.                          ---------------------------------------------
  1838.           Syntax         char *helpgetcontext(void);
  1839.                          void helpsetcontext(char *context);
  1840.  
  1841.           Include        pictor.h
  1842.  
  1843.           Description    The helpgetcontext and helpsetcontext macros get
  1844.                          and set the current help context. These functions
  1845.                          aid in the development of applications with
  1846.                          context-sensitive help.
  1847.  
  1848.                          Many PICTOR library routines that get input from
  1849.                          the user (such as messagebox and editbox) call
  1850.                          helprun if the user presses <F1> (assuming that
  1851.                          the help system has been enabled using helpopen).
  1852.                          The help context is a pointer to a help topic
  1853.                          string that gets passed to helprun by these
  1854.                          functions. Note that the help context does not
  1855.                          affect calls made directly to helprun by your
  1856.                          application.
  1857.  
  1858.           Returns        helpgetcontext returns a pointer to the current
  1859.                          help context string.
  1860.  
  1861.           See also       helpopen, helprun
  1862.  
  1863.  
  1864.                          helprun
  1865.  
  1866.  
  1867.  
  1868.                                          31
  1869.                           PICTOR User's Guide and Reference
  1870.  
  1871.  
  1872.                          ---------------------------------------------
  1873.           Syntax         int helprun(char *topic);
  1874.  
  1875.           Include        pictor.h
  1876.  
  1877.           Description    Runs the help system. topic is a pointer to a help
  1878.                          topic string and should match a @BEGIN label
  1879.                          defined in the help file. If topic is NULL, the
  1880.                          help index is displayed and the user can select
  1881.                          from any topic in the help file. Note that you
  1882.                          must call helpopen to activate the help system
  1883.                          prior to calling helprun. See the tutorial section
  1884.                          for a discussion about creating on-line help.
  1885.  
  1886.                          Note that since messagebox and listbox can be
  1887.                          called from helprun, and helprun can be called
  1888.                          from messagebox and listbox, helprun simply calls
  1889.                          beep if helprun gets called recursively (gets
  1890.                          called when it is already active).
  1891.  
  1892.           Returns        TRUE if help was successful, FALSE if an error
  1893.                          occurred. Note that if an error occurred, helprun
  1894.                          displays a message to notify the user of the
  1895.                          nature of the error.
  1896.  
  1897.           See also       helpclose, helpopen, helpsetcontext
  1898.  
  1899.           Example
  1900.  
  1901.                /*
  1902.                ** HELPRUN.C: Help file viewer.
  1903.                */
  1904.  
  1905.                #include <stdio.h>
  1906.                #include <pictor.h>
  1907.  
  1908.                COLORSTRUCT helpcolors = {
  1909.                   foreback(BLACK,WHITE),
  1910.                   foreback(BOLD|WHITE,WHITE),
  1911.                   foreback(WHITE,BLACK),
  1912.                   foreback(BLACK,BLACK)
  1913.                };
  1914.  
  1915.                COLORSTRUCT msgcolors = {
  1916.                   foreback(BLACK,CYAN),
  1917.                   foreback(BOLD|WHITE,CYAN),
  1918.                   foreback(WHITE,BLACK),
  1919.                   foreback(BOLD|WHITE,BLACK)
  1920.                };
  1921.  
  1922.                void main(int argc,char *argv[])
  1923.                {
  1924.                   /* check command-line arguments */
  1925.                   if(argc != 2) {
  1926.  
  1927.  
  1928.  
  1929.                                          32
  1930.                           PICTOR User's Guide and Reference
  1931.  
  1932.  
  1933.                      printf("Usage:\tHELPRUN <hlpfile>\n");
  1934.                      return;
  1935.                   }
  1936.  
  1937.                   /* initialize library */
  1938.                   initvideo();
  1939.  
  1940.                   cls();
  1941.                   initstatus(25,helpcolors.normal);
  1942.  
  1943.                   /* capture Ctrl-Break & critical error interrupts */
  1944.                   hookints(&msgcolors);
  1945.  
  1946.                   /* activate help system */
  1947.                   helpopen(argv[1],&helpcolors,&msgcolors);
  1948.  
  1949.                   /* run help starting with help index */
  1950.                   helprun(NULL);
  1951.  
  1952.                   /* restore screen */
  1953.                   vcolor(foreback(WHITE,BLACK));
  1954.                   cls();
  1955.                }
  1956.  
  1957.  
  1958.                          hookints
  1959.                          ---------------------------------------------
  1960.           Syntax         int hookints(COLORSTRUCT *colors);
  1961.  
  1962.           Include        pictor.h
  1963.  
  1964.           Description    This function installs interrupt handlers for
  1965.                          Ctrl-C, Ctrl-Break and critical errors (interrupts
  1966.                          0x23, 0x1B and 0x24). The handlers for Ctrl-C and
  1967.                          Ctrl-Break simply return. The handler for critical
  1968.                          errors calls messagebox to display an error
  1969.                          message with the MB_RETRYABORT flag. colors points
  1970.                          to a COLORSTRUCT structure that contains the
  1971.                          colors that will be passed to messagebox during
  1972.                          critical errors.
  1973.  
  1974.                          hookints makes your application more robust by
  1975.                          preventing premature termination due to the user
  1976.                          pressing <Ctrl-Break>, or aborting a critical
  1977.                          error. In addition, the critical error handler
  1978.                          prevents the default MS-DOS critical error handler
  1979.                          from writing to the display, and errors can be
  1980.                          handled in a consistent, user-friendly way.
  1981.  
  1982.                          hookints registers unhookints with the ANSI C
  1983.                          library function atexit. This causes unhookints to
  1984.                          be called (and the installed handlers to be
  1985.                          uninstalled) upon normal program termination.
  1986.  
  1987.  
  1988.  
  1989.  
  1990.                                          33
  1991.                           PICTOR User's Guide and Reference
  1992.  
  1993.  
  1994.           Returns        0 if the function is successful or -1 if an error
  1995.                          occurred.
  1996.  
  1997.           See also       unhookints
  1998.  
  1999.           Example        For an example of hookints, please see the helprun
  2000.                          example.
  2001.  
  2002.  
  2003.                          hputs
  2004.                          ---------------------------------------------
  2005.           Syntax         void hputs(char *string, int hcolor);
  2006.  
  2007.           Include        pictor.h
  2008.  
  2009.           Description    The hputs function prints a string that contains
  2010.                          highlighted characters. This function is useful
  2011.                          for printing menu selections with embedded
  2012.                          "hotkeys", and is used by several PICTOR library
  2013.                          functions such as runmenu and messagebox.
  2014.  
  2015.                          hputs prints string using the current default
  2016.                          colors. Any characters that are preceded by a
  2017.                          tilde character (~) are printed using hcolor. The
  2018.                          tilde character is not printed.
  2019.  
  2020.           See also       gethotkey, hstrlen
  2021.  
  2022.           Example
  2023.  
  2024.                /*
  2025.                ** HPUTS.C: Writes a string using hputs.
  2026.                */
  2027.  
  2028.                #include <pictor.h>
  2029.  
  2030.                void main()
  2031.                {
  2032.                   /* initialize library */
  2033.                   initvideo();
  2034.  
  2035.                   setvpos(5,10);
  2036.                   vcolor(foreback(BOLD+CYAN,BLUE));
  2037.                   cls();
  2038.  
  2039.                   hputs("~Retry, ~Abort, ~Fail, ~F~1=Help",
  2040.                      foreback(BOLD+WHITE,BLUE));
  2041.                }
  2042.  
  2043.  
  2044.                          hstrlen
  2045.                          ---------------------------------------------
  2046.           Syntax         int hstrlen(char *string);
  2047.  
  2048.  
  2049.  
  2050.  
  2051.                                          34
  2052.                           PICTOR User's Guide and Reference
  2053.  
  2054.  
  2055.           Include        pictor.h
  2056.  
  2057.           Description    This function returns the length of a string as
  2058.                          printed by hputs. This is the number of characters
  2059.                          in string, not counting the tilde character (~).
  2060.  
  2061.           Returns        The number of characters in string that would be
  2062.                          displayed by hputs.
  2063.  
  2064.           See also       hputs
  2065.  
  2066.  
  2067.                          initstatus
  2068.                          ---------------------------------------------
  2069.           Syntax         void initstatus(int row, int color);
  2070.  
  2071.           Include        pictor.h
  2072.  
  2073.           Description    This function specifies parameters used by the
  2074.                          statusbar function to display the status bar. row
  2075.                          specifies the status row and color specifies the
  2076.                          status bar color. By default, the status bar
  2077.                          appears on row 25 with a color attribute equal to
  2078.                          foreback(BLACK, WHITE).
  2079.  
  2080.           See also       statusbar
  2081.  
  2082.  
  2083.                          initvideo
  2084.                          ---------------------------------------------
  2085.           Syntax         void initvideo(void);
  2086.  
  2087.           Include        pictor.h
  2088.  
  2089.           Description    initvideo determines the type and configuration of
  2090.                          the host display adapter, and initializes internal
  2091.                          variables appropriately. This function should be
  2092.                          called at the start of your program. IMPORTANT:
  2093.                          Many PICTOR library routines require that
  2094.                          initvideo has already been called in order for
  2095.                          those routines to work correctly.
  2096.  
  2097.                          Use getvconfig to retrieve information about the
  2098.                          current display configuration.
  2099.  
  2100.           See also       getvconfig, snowcheckoff
  2101.  
  2102.  
  2103.                          installclock
  2104.                          ---------------------------------------------
  2105.           Syntax         int installclock(int row, int column, int color);
  2106.  
  2107.           Include        pictor.h
  2108.  
  2109.  
  2110.  
  2111.  
  2112.                                          35
  2113.                           PICTOR User's Guide and Reference
  2114.  
  2115.  
  2116.           Description    This function puts a clock on the screen at the
  2117.                          location specified by row and column using the
  2118.                          color attribute specified by color. The clock is
  2119.                          automatically updated to display the current time.
  2120.  
  2121.                          When installclock is called for the first time, it
  2122.                          registers removeclock with the ANSI C library
  2123.                          function atexit. This causes removeclock to be
  2124.                          called upon normal program termination. Note that
  2125.                          when your program terminates, it is possible for
  2126.                          the clock to display itself between the time your
  2127.                          program clears the screen and the time removeclock
  2128.                          is called by atexit. In this situation, you might
  2129.                          want to call removeclock explicitly before your
  2130.                          program clears the screen.
  2131.  
  2132.           Returns        0 if successful or -1 if an error occurred.
  2133.  
  2134.           See also       removeclock
  2135.  
  2136.           Example
  2137.  
  2138.                /*
  2139.                ** INSTCLCK.C: Installs an on-screen clock.
  2140.                */
  2141.  
  2142.                #include <pictor.h>
  2143.  
  2144.                void main()
  2145.                {
  2146.                   /* initialize library */
  2147.                   initvideo();
  2148.  
  2149.                   cls();
  2150.                   installclock(1,1,foreback(BLACK,WHITE));
  2151.  
  2152.                   setvpos(5,5);
  2153.                   vputs("Press any key to move clock");
  2154.                   kbdread();
  2155.  
  2156.                   removeclock();
  2157.                   cls();
  2158.                   installclock(1,74,foreback(BLACK,WHITE));
  2159.  
  2160.                   setvpos(5,5);
  2161.                   vputs("Press any key to exit");
  2162.                   kbdread();
  2163.                }
  2164.  
  2165.  
  2166.                          kbdedit
  2167.                          ---------------------------------------------
  2168.           Syntax         int kbdedit(char *buffer, int row,
  2169.                               int column, int width,int maxlength,
  2170.  
  2171.  
  2172.  
  2173.                                          36
  2174.                           PICTOR User's Guide and Reference
  2175.  
  2176.  
  2177.                               COLORSTRUCT *colors);
  2178.  
  2179.           Include        pictor.h
  2180.  
  2181.           Description    This function allows the user to edit a line of
  2182.                          text. buffer is where the text will be stored. row
  2183.                          and column specify the screen location. width
  2184.                          specifies how many display columns kbdedit will
  2185.                          use for editing. maxlength specifies the maximum
  2186.                          number of characters the string can contain. If
  2187.                          maxlength is greater than width, the text is
  2188.                          scrolled horizontally as the string grows longer
  2189.                          than the edit area. buffer must be big enough to
  2190.                          hold maxlength + 1 characters.
  2191.  
  2192.                          If buffer already contains a string, kbdedit
  2193.                          highlights the existing text to indicate that it
  2194.                          is selected. If the user types an editing key
  2195.                          (such as <Backspace>, <Left>, or <End>), the
  2196.                          selected text becomes unselected and the user can
  2197.                          modify the existing string. Otherwise, if the user
  2198.                          begins typing a new string, it automatically
  2199.                          replaces the selected text.
  2200.  
  2201.                          kbdedit uses an internal buffer of 129 bytes.
  2202.                          buffer should never contain a string of more than
  2203.                          128 characters or the internal buffer will
  2204.                          overflow. If maxlength is greater than 128,
  2205.                          kbdedit uses 128 as the maximum length.
  2206.  
  2207.           See also       kbdread, editbox
  2208.  
  2209.           Returns        TRUE if the user pressed <Enter>, or FALSE if the
  2210.                          user pressed <Escape>. If the user pressed
  2211.                          <Escape>, the original contents of buffer are not
  2212.                          modified.
  2213.  
  2214.           Example
  2215.  
  2216.                /*
  2217.                ** KBDEDIT.C: Lets the user edit a string
  2218.                ** using kbdedit.
  2219.                */
  2220.  
  2221.                #include <stdio.h>
  2222.                #include <pictor.h>
  2223.  
  2224.                COLORSTRUCT colors = {
  2225.                   foreback(BLACK,WHITE),
  2226.                   0x00,  /* not used by kbdedit() */
  2227.                   foreback(WHITE,BLACK),
  2228.                   0x00   /* not used by kbdedit() */
  2229.                };
  2230.  
  2231.  
  2232.  
  2233.  
  2234.                                          37
  2235.                           PICTOR User's Guide and Reference
  2236.  
  2237.  
  2238.                char buffer[128];
  2239.  
  2240.                void main()
  2241.                {
  2242.                   int i;
  2243.  
  2244.                   /* initialize library */
  2245.                   initvideo();
  2246.  
  2247.                   /* clear screen */
  2248.                   vcolor(foreback(BOLD+WHITE,BLUE));
  2249.                   cls();
  2250.  
  2251.                   setvpos(3,5);
  2252.                   vputs("KbdEdit: [");
  2253.                   setvpos(3,15 + 25);
  2254.                   vputc(']');
  2255.  
  2256.                   i = kbdedit(buffer,3,15,25,127,&colors);
  2257.  
  2258.                   /* restore screen */
  2259.                   vcolor(foreback(WHITE,BLACK));
  2260.                   cls();
  2261.  
  2262.                   /* print result */
  2263.                   if(i == TRUE)
  2264.                      printf("You entered: %s\n",buffer);
  2265.                   else
  2266.                      printf("You pressed <Escape>\n");
  2267.  
  2268.                }
  2269.  
  2270.  
  2271.                          kbdflush
  2272.                          ---------------------------------------------
  2273.           Syntax         int kbdflush(void);
  2274.  
  2275.           Include        pictor.h
  2276.  
  2277.           Description    This function flushes any keystrokes waiting in
  2278.                          the keyboard buffer or stuffed using kbdpush.
  2279.  
  2280.           Returns        The number of keystrokes that were in the keyboard
  2281.                          buffer before it was flushed.
  2282.  
  2283.           See also       kbdread, kbdready
  2284.  
  2285.  
  2286.                          kbdpush
  2287.                          ---------------------------------------------
  2288.           Syntax         void kbdpush(int key);
  2289.  
  2290.           Include        pictor.h
  2291.  
  2292.  
  2293.  
  2294.  
  2295.                                          38
  2296.                           PICTOR User's Guide and Reference
  2297.  
  2298.  
  2299.           Description    Stuffs key into the keyboard buffer so that it is
  2300.                          the next key returned by kbdread. Only one key can
  2301.                          be stuffed at a time. If kbdpush is called twice
  2302.                          with no intervening call to kbdread, the first key
  2303.                          pushed will be lost.
  2304.  
  2305.           See also       kbdread, kbdready
  2306.  
  2307.  
  2308.                          kbdread
  2309.                          ---------------------------------------------
  2310.           Syntax         int kbdread(void)
  2311.  
  2312.           Include        pictor.h
  2313.  
  2314.           Description    This function retrieves the next available
  2315.                          keystroke. The value returned indicates which key
  2316.                          was pressed. The low byte is the key's ASCII code
  2317.                          (or 0 if the key has no ASCII code) and the high
  2318.                          byte is the key's scan code. The returned value is
  2319.                          the same as the one returned by the ROM BIOS
  2320.                          interrupt 16h, function 00h except for <Ctrl-
  2321.                          Break>. kbdread returns 0xFFFF for <Ctrl-Break>
  2322.                          while the ROM BIOS returns 0x0000.
  2323.  
  2324.                          PICTOR.H defines constants for many keyboard
  2325.                          codes.
  2326.  
  2327.           Returns        The next available keystroke as described above.
  2328.  
  2329.           See also       escpressed, kbdpush, kbdready, kbdshift
  2330.  
  2331.  
  2332.                          kbdready
  2333.                          ---------------------------------------------
  2334.           Syntax         int kbdready(void)
  2335.  
  2336.           Include        pictor.h
  2337.  
  2338.           Description    This function indicates if there are any
  2339.                          keystrokes waiting in the keyboard buffer. If
  2340.                          there are keystrokes waiting, the next available
  2341.                          keystroke (as returned by kbdread) is returned_but
  2342.                          not removed_from the keyboard buffer. Otherwise, 0
  2343.                          is returned.
  2344.  
  2345.           Returns        The next available keystroke as described above,
  2346.                          or 0 if no keystrokes are available.
  2347.  
  2348.           See also       kbdpush, kbdread
  2349.  
  2350.  
  2351.                          kbdshift
  2352.                          ---------------------------------------------
  2353.  
  2354.  
  2355.  
  2356.                                          39
  2357.                           PICTOR User's Guide and Reference
  2358.  
  2359.  
  2360.           Syntax         int kbdshift(void);
  2361.  
  2362.           Include        pictor.h
  2363.  
  2364.           Description    This function returns the state of various
  2365.                          keyboard shift keys as follows:
  2366.  
  2367.  
  2368.                          Bit  Meaning (if set)
  2369.                          ---------------------------------------------
  2370.                          0    Right shift key is down
  2371.                          1    Left shift key is down
  2372.                          2    Ctrl key is down
  2373.                          3    Alt key is down
  2374.                          4    Scroll lock is on
  2375.                          5    Num Lock is on
  2376.                          6    Caps Lock is on
  2377.                          7    Insert is on
  2378.  
  2379.           Returns        The current shift status as described above.
  2380.  
  2381.           See also       kbdread
  2382.  
  2383.           Example
  2384.  
  2385.                /*
  2386.                ** KBDSHIFT.C: Displays the state of the shift keys until
  2387.                ** the user presses <Escape>.
  2388.                */
  2389.  
  2390.                #include <pictor.h>
  2391.  
  2392.                char *labels[] = {
  2393.                   "Right shift key down",
  2394.                   "Left shift key down",
  2395.                   "Ctrl-key down",
  2396.                   "Alt key down",
  2397.                   "Scroll Lock on",
  2398.                   "Num Lock on",
  2399.                   "Caps Lock on",
  2400.                   "Insert on",
  2401.                };
  2402.  
  2403.                void main()
  2404.                {
  2405.                   int i,shiftstate;
  2406.  
  2407.                   /* initialize library */
  2408.                   initvideo();
  2409.  
  2410.                   /* clear screen and hide cursor */
  2411.                   cls();
  2412.                   showcurs(FALSE);
  2413.  
  2414.  
  2415.  
  2416.  
  2417.                                          40
  2418.                           PICTOR User's Guide and Reference
  2419.  
  2420.  
  2421.                   setvpos(10,1);
  2422.                   vputs("Press <Escape> to end");
  2423.  
  2424.                   while(!kbdready() || kbdread() != ESCAPE_KEY) {
  2425.                      shiftstate = kbdshift();
  2426.                      for(i = 0;i < 8;i++) {
  2427.                         setvpos(1 + i,1);
  2428.                         xprintf(vputs,"%s: %s",labels[i],
  2429.                            (shiftstate & (0x01 << i)) ? "Yes" : "No ");
  2430.                      }
  2431.                   }
  2432.  
  2433.                   /* restore screen */
  2434.                   showcurs(TRUE);
  2435.                   cls();
  2436.                }
  2437.  
  2438.  
  2439.                          listbox
  2440.                          ---------------------------------------------
  2441.           Syntax         int listbox(char **items, int numitems,
  2442.                               int *selection, char *title,
  2443.                               COLORSTRUCT *colors);
  2444.  
  2445.           Include        pictor.h
  2446.  
  2447.           Description    This function allows the user to select from an
  2448.                          array of items. items is the address of an array
  2449.                          of string pointers; these strings are the items
  2450.                          that will appear in the list box. numitems is the
  2451.                          number of items in the array. selection points to
  2452.                          an integer that contains the initial selection. If
  2453.                          selection points to an integer with a value of 0,
  2454.                          the first item in the list is highlighted when
  2455.                          listbox opens. If the user pressed <Return>, the
  2456.                          integer pointed to by selection is modified to
  2457.                          indicate which item was selected; if the user
  2458.                          pressed <Escape>, the integer pointed to by
  2459.                          selection is not modified. title is the title
  2460.                          given to the window (use NULL for no title) and
  2461.                          colors is a pointer to a COLORSTRUCT structure
  2462.                          that contains the colors used to display the
  2463.                          window.
  2464.  
  2465.           Returns        TRUE if the user pressed <Return>, FALSE if the
  2466.                          user pressed <Escape> or if numitems is 0. You can
  2467.                          use escpressed to determine if the user pressed
  2468.                          <Escape>.
  2469.  
  2470.           See also       escpressed, pickfile
  2471.  
  2472.           Example
  2473.  
  2474.                /*
  2475.  
  2476.  
  2477.  
  2478.                                          41
  2479.                           PICTOR User's Guide and Reference
  2480.  
  2481.  
  2482.                ** LISTBOX.C: Lets the user select from a list
  2483.                ** of items.
  2484.                */
  2485.  
  2486.                #include <stdio.h>
  2487.                #include <pictor.h>
  2488.  
  2489.                #define NUM_ITEMS   7
  2490.                char *items[NUM_ITEMS] = {
  2491.                   "Apples",
  2492.                   "Bananas",
  2493.                   "Carrots",
  2494.                   "Grapes",
  2495.                   "Kiwi",
  2496.                   "Raisins",
  2497.                   "Watermelon",
  2498.                };
  2499.  
  2500.                COLORSTRUCT colors = {
  2501.                   foreback(BOLD+CYAN,BLUE),
  2502.                   foreback(BOLD+WHITE,CYAN),
  2503.                   foreback(BLACK,WHITE),
  2504.                   foreback(BOLD+WHITE,WHITE)
  2505.                };
  2506.  
  2507.                void main()
  2508.                {
  2509.                   char buffer[45];
  2510.                   int sel = 0;
  2511.  
  2512.                   /* initialize the library */
  2513.                   initvideo();
  2514.  
  2515.                   if(listbox(items,NUM_ITEMS,&sel,"Fruit",&colors)) {
  2516.                      sprintf(buffer,"You selected %s",items[sel]);
  2517.                      messagebox(buffer,NULL,MB_OK,&colors);
  2518.                   }
  2519.                   else {
  2520.                      messagebox("You pressed <Escape>",NULL,MB_OK,
  2521.                         &colors);
  2522.                   }
  2523.                }
  2524.  
  2525.  
  2526.                          messagebox
  2527.                          ---------------------------------------------
  2528.           Syntax         int messagebox(char *message, char *title,
  2529.                               int flags,COLORSTRUCT *colors);
  2530.  
  2531.           Include        pictor.h
  2532.  
  2533.           Description    messagebox displays a window with a message and
  2534.                          allows the user to select from 1 or more
  2535.                          predefined responses. message is the message
  2536.  
  2537.  
  2538.  
  2539.                                          42
  2540.                           PICTOR User's Guide and Reference
  2541.  
  2542.  
  2543.                          displayed in the window. message can contain new-
  2544.                          line ('\n') characters for multi-line messages.
  2545.                          title is the title given to the window (use NULL
  2546.                          for no title). colors is a pointer to a
  2547.                          COLORSTRUCT structure that contains the colors
  2548.                          used to display the window. flags determines the
  2549.                          responses made available to the user and can be
  2550.                          any one of the following constants defined in
  2551.                          PICTOR.H:
  2552.  
  2553.                          Constant       Meaning
  2554.                          ---------------------------------------------
  2555.                          MB_OK          The user is given a single
  2556.                                         selection labeled OK.
  2557.                          MB_OKCANCEL    The user can select between OK and
  2558.                                         Cancel.
  2559.                          MB_RETRYCANCEL The user can select between Retry
  2560.                                         and Cancel.
  2561.                          MB_RETRYABORT  The user can select between Retry
  2562.                                         and Abort.
  2563.                          MB_YESNO       The user can select between Yes and
  2564.                                         No.
  2565.                          MB_YESNOCANCEL The user can select between Yes, No
  2566.                                         and Cancel.
  2567.  
  2568.           Returns        If a single response is available as with MB_OK,
  2569.                          messagebox always returns 0. If two responses are
  2570.                          available as with MB_OKCANCEL, messagebox returns
  2571.                          1 if OK is selected and 0 if Cancel is selected.
  2572.                          If three responses are available as with
  2573.                          MB_YESNOCANCEL, messagebox returns 2 if Yes is
  2574.                          selected, 1 if No is selected and 0 if Cancel is
  2575.                          selected. Also, if the user presses <Escape>,
  2576.                          messagebox returns 0. You can use the escpressed
  2577.                          macro determine if 0 was returned because the
  2578.                          right-most response was selected or <Escape> was
  2579.                          pressed.
  2580.  
  2581.           See also       escpressed
  2582.  
  2583.           Example
  2584.  
  2585.                /*
  2586.                ** MSGBOX.C: Takes action based on the user's response
  2587.                ** to a message box.
  2588.                */
  2589.  
  2590.                #include <pictor.h>
  2591.  
  2592.                COLORSTRUCT msgcolors = {
  2593.                   foreback(BOLD+WHITE,RED),
  2594.                   foreback(BOLD+YELLOW,RED),
  2595.                   foreback(BLACK,WHITE),
  2596.                   foreback(BOLD+WHITE,WHITE)
  2597.  
  2598.  
  2599.  
  2600.                                          43
  2601.                           PICTOR User's Guide and Reference
  2602.  
  2603.  
  2604.                };
  2605.  
  2606.                void main()
  2607.                {
  2608.                   /* initialize library */
  2609.                   initvideo();
  2610.  
  2611.                   /* clear screen if user selects yes */
  2612.                   if(messagebox("Do you want the screen cleared?",
  2613.                      "Question",MB_YESNO,&msgcolors)) {
  2614.  
  2615.                      vcolor(foreback(WHITE,BLACK));
  2616.                      cls();
  2617.                   }
  2618.                }
  2619.  
  2620.  
  2621.                          multiedit
  2622.                          ---------------------------------------------
  2623.           Syntax         int multiedit(MEDITSTRUCT *items,
  2624.                               int numitems, char *title,
  2625.                               COLORSTRUCT *colors);
  2626.  
  2627.           Include        pictor.h
  2628.  
  2629.           Description    This function creates an edit box with multiple
  2630.                          edit fields. The user can move between fields by
  2631.                          pressing <Tab> and <Shift-Tab>. items points to
  2632.                          the first element of an array of MEDITSTRUCT
  2633.                          structures. The MEDITSTRUCT structures describe
  2634.                          each field of the multi-edit box and contain the
  2635.                          following members:
  2636.  
  2637.                          Member         Description
  2638.                          ---------------------------------------------
  2639.                          char *prompt   Prompt message for this field
  2640.                          char *buffer   Buffer to store text
  2641.                          int maxlen     Maximum number of characters
  2642.                                         allowed in this field
  2643.  
  2644.                          numitems is the number of MEDITSTRUCT structures
  2645.                          in the array and, therefore, the number of fields
  2646.                          in the edit box. title is the title given to the
  2647.                          window (use NULL for no title). colors points to a
  2648.                          COLORSTRUCT structure that contains the colors
  2649.                          used to display the window.
  2650.  
  2651.           Returns        TRUE if the user pressed <Enter>, FALSE if the
  2652.                          user pressed <Escape>. Unlike kbdedit, some fields
  2653.                          may have been modified when this function returns
  2654.                          even if <Escape> was pressed.
  2655.  
  2656.           See also       editbox, kbdedit
  2657.  
  2658.  
  2659.  
  2660.  
  2661.                                          44
  2662.                           PICTOR User's Guide and Reference
  2663.  
  2664.  
  2665.           Example
  2666.  
  2667.                /*
  2668.                ** MULTEDIT.C: Uses multiedit to display a dialog
  2669.                ** box with multiple edit fields.
  2670.                */
  2671.  
  2672.                #include <stdio.h>
  2673.                #include <pictor.h>
  2674.  
  2675.                #define MAX_LEN          25
  2676.                char buff1[MAX_LEN + 1];
  2677.                char buff2[MAX_LEN + 2];
  2678.  
  2679.                #define NUM_ITEMS   2
  2680.                MEDITSTRUCT items[NUM_ITEMS] = {
  2681.                   { "Find What",buff1,MAX_LEN },
  2682.                   { "Replace with",buff2,MAX_LEN }
  2683.                };
  2684.  
  2685.                COLORSTRUCT colors = {
  2686.                   foreback(BLACK,WHITE),
  2687.                   foreback(BOLD+WHITE,WHITE),
  2688.                   foreback(WHITE,BLACK),
  2689.                   foreback(BOLD+WHITE,BLACK)
  2690.                };
  2691.  
  2692.                void main()
  2693.                {
  2694.                   char buffer[81];
  2695.  
  2696.                   /* initialize library */
  2697.                   initvideo();
  2698.  
  2699.                   if(multiedit(items,NUM_ITEMS,"Replace",&colors)) {
  2700.                      sprintf(buffer,
  2701.                         "You entered:\n\"%s\"\nand:\n\"%s\"",
  2702.                         buff1,buff2);
  2703.                      messagebox(buffer,NULL,MB_OK,&colors);
  2704.                   }
  2705.                   else {
  2706.                      messagebox("You pressed <Escape>",NULL,MB_OK,
  2707.                         &colors);
  2708.                   }
  2709.                }
  2710.  
  2711.  
  2712.                          pause
  2713.                          ---------------------------------------------
  2714.           Syntax         void pause(int duration);
  2715.  
  2716.           Include        pictor.h
  2717.  
  2718.  
  2719.  
  2720.  
  2721.  
  2722.                                          45
  2723.                           PICTOR User's Guide and Reference
  2724.  
  2725.  
  2726.           Description    pause returns after the specified period of time
  2727.                          has elapsed. duration specifies the pause duration
  2728.                          in approximately 18ths of a second (a duration of
  2729.                          18 is just under one second).
  2730.  
  2731.  
  2732.                          pickfile
  2733.                          ---------------------------------------------
  2734.           Syntax         char *pickfile(char *filespec, char *title,
  2735.                               COLORSTRUCT *colors);
  2736.  
  2737.           Include        pictor.h
  2738.  
  2739.           Description    This function uses listbox to let the user select
  2740.                          from a sorted list of files. filespec masks which
  2741.                          files to include in the selection. title specifies
  2742.                          the window title passed to listbox (use NULL for
  2743.                          no title). colors points to a COLORSTRUCT
  2744.                          structure that contains the colors used to display
  2745.                          the window.
  2746.  
  2747.                          If the user selects a file, pickfile returns a
  2748.                          pointer to the file name. You should make use of
  2749.                          the pointer as soon as possible since another call
  2750.                          to pickfile can change the data it points to.
  2751.  
  2752.           Returns        A pointer to the selected filename or NULL if the
  2753.                          user pressed <Escape>, or if an error occurred (in
  2754.                          which case pickfile displays a message notifying
  2755.                          the user). You can use the escpressed macro to
  2756.                          determine if the user pressed <Escape>.
  2757.  
  2758.           See also       escpressed, listbox
  2759.  
  2760.           Example
  2761.  
  2762.                /*
  2763.                ** PICKFILE.C: Lets the user select a file in the
  2764.                ** current directory.
  2765.                */
  2766.  
  2767.                #include <stdio.h>
  2768.                #include <pictor.h>
  2769.  
  2770.                COLORSTRUCT colors = {
  2771.                   foreback(BOLD+CYAN,BLUE),
  2772.                   foreback(BOLD+WHITE,CYAN),
  2773.                   foreback(BLACK,WHITE),
  2774.                   foreback(BOLD+WHITE,WHITE)
  2775.                };
  2776.  
  2777.                void main()
  2778.                {
  2779.                   char buffer[45];
  2780.  
  2781.  
  2782.  
  2783.                                          46
  2784.                           PICTOR User's Guide and Reference
  2785.  
  2786.  
  2787.                   char *cptr;
  2788.  
  2789.                   /* initialize the library */
  2790.                   initvideo();
  2791.  
  2792.                   cptr = pickfile("*.*","Pick a File",&colors);
  2793.                   if(cptr != NULL) {
  2794.                      sprintf(buffer,"You selected %s",cptr);
  2795.                      messagebox(buffer,NULL,MB_OK,&colors);
  2796.                   }
  2797.                   else {
  2798.                      messagebox("You pressed <Escape>",NULL,MB_OK,
  2799.                         &colors);
  2800.                   }
  2801.                }
  2802.  
  2803.  
  2804.                          popcurs, pushcurs
  2805.                          ---------------------------------------------
  2806.           Syntax         int popcurs(void);
  2807.                          int pushcurs(void);
  2808.  
  2809.           Include        pictor.h
  2810.  
  2811.           Description    These functions work together to save and restore
  2812.                          the cursor state. pushcurs saves the current
  2813.                          hardware text cursor position and cursor type.
  2814.                          popcurs restores the cursor position and type to
  2815.                          what it was before the last call to pushcurs.
  2816.  
  2817.           Returns        Both functions return TRUE if they are successful.
  2818.                          pushcurs returns FALSE if there is no more room to
  2819.                          save the cursor; popcurs returns FALSE if there is
  2820.                          no saved cursor to pop.
  2821.  
  2822.  
  2823.                          popstatus, pushstatus
  2824.                          ---------------------------------------------
  2825.           Syntax         int popstatus(void);
  2826.                          int pushstatus(void);
  2827.  
  2828.           Include        pictor.h
  2829.  
  2830.           Description    These functions work together to save the status
  2831.                          bar and then restore it. pushstatus save the
  2832.                          contents of, and then clears, the status bar.
  2833.                          popstatus restores the status bar to how it
  2834.                          appeared prior to the last call to pushstatus.
  2835.  
  2836.           Returns        Both function return TRUE if they are successful.
  2837.                          pushstatus returns FALSE if there is no more room
  2838.                          to save the status bar. popstatus returns FALSE if
  2839.                          there is no saved status bar to pop.
  2840.  
  2841.  
  2842.  
  2843.  
  2844.                                          47
  2845.                           PICTOR User's Guide and Reference
  2846.  
  2847.  
  2848.  
  2849.                          prnputc
  2850.                          ---------------------------------------------
  2851.           Syntax         int prnputc(char c);
  2852.  
  2853.           Include        pictor.h
  2854.  
  2855.           Description    This function writes c to the standard list device
  2856.                          (printer).
  2857.  
  2858.           Returns        0 if successful or a non-zero value if an error
  2859.                          occurred.
  2860.  
  2861.           See also       prnputs, prnwrite
  2862.  
  2863.  
  2864.                          prnputs
  2865.                          ---------------------------------------------
  2866.           Syntax         int prnputs(char *string);
  2867.  
  2868.           Include        pictor.h
  2869.  
  2870.           Description    This function writes string to the standard list
  2871.                          device (printer).
  2872.  
  2873.           Returns        0 if successful or a non-zero value if an error
  2874.                          occurred.
  2875.  
  2876.           See also       prnputc, prnwrite
  2877.  
  2878.  
  2879.                          prnwrite
  2880.                          ---------------------------------------------
  2881.           Syntax         int prnwrite(char *buffer, int count);
  2882.  
  2883.           Include        pictor.h
  2884.  
  2885.           Description    This function writes a series of characters to the
  2886.                          standard list device (printer). buffer is where
  2887.                          the characters are stored and count is the number
  2888.                          of characters to be written.
  2889.  
  2890.           Returns        0 if successful or a non-zero value if an error
  2891.                          occurred.
  2892.  
  2893.           See also       prnputc, prnputs
  2894.  
  2895.  
  2896.                          putscrn
  2897.                          ---------------------------------------------
  2898.           Syntax         void putscrn(int *buffer, int top, int left,
  2899.                               int height, int width);
  2900.  
  2901.           Include        pictor.h
  2902.  
  2903.  
  2904.  
  2905.                                          48
  2906.                           PICTOR User's Guide and Reference
  2907.  
  2908.  
  2909.  
  2910.           Description    Copies the contents of buffer to the display area
  2911.                          described by the last four arguments. putscrn is
  2912.                          useful for closing a window by writing the
  2913.                          original contents of the screen (saved with
  2914.                          getscrn) back to the screen. Since wclose
  2915.                          automatically calls this function to close a
  2916.                          window, you won't need to call putscrn unless you
  2917.                          are creating customized windowing routines.
  2918.  
  2919.           See also       getscrn
  2920.  
  2921.  
  2922.                          readtree
  2923.                          ---------------------------------------------
  2924.           Syntax         NODE *readtree(BYTE *buffer);
  2925.  
  2926.           Include        compress.h
  2927.  
  2928.           Description    Builds a compression code tree from a buffer
  2929.                          created with writetree.
  2930.  
  2931.           Returns        The root node to the compression code tree or NULL
  2932.                          if there was not enough memory.
  2933.  
  2934.           See also       compress, freetree, gettree, uncompress, writetree
  2935.  
  2936.           Example        For an example of readtree, please see the
  2937.                          uncompress example.
  2938.  
  2939.  
  2940.                          removeclock
  2941.                          ---------------------------------------------
  2942.           Syntax         int removeclock(void);
  2943.  
  2944.           Include        pictor.h
  2945.  
  2946.           Description    Removes the on-screen clock previously installed
  2947.                          by installclock. Note that installclock
  2948.                          automatically registers removeclock with the ANSI
  2949.                          C library routine atexit. This causes removeclock
  2950.                          to be called upon normal program termination. As a
  2951.                          result, you do not need to call removeclock.
  2952.                          However, you might call this function if you want
  2953.                          to stop the clock before your program terminates
  2954.                          or if you want to re-install the clock at a
  2955.                          different location.
  2956.  
  2957.                          The installclock function traps interrupt 0x1C.
  2958.                          comopen also traps interrupt 0x1C. If you are
  2959.                          using both functions and you need to manually
  2960.                          remove or close either one, they must be
  2961.                          uninstalled in the reverse order that they were
  2962.                          installed.
  2963.  
  2964.  
  2965.  
  2966.                                          49
  2967.                           PICTOR User's Guide and Reference
  2968.  
  2969.  
  2970.  
  2971.           Returns        0 if successful or -1 if an error occurred.
  2972.  
  2973.           See also       installclock
  2974.  
  2975.           Example        For an example of removeclock, please see the
  2976.                          installclock example.
  2977.  
  2978.  
  2979.                          runmenu
  2980.                          ---------------------------------------------
  2981.           Syntax         int runmenu(MAINMENU *menu,
  2982.                               COLORSTRUCT *maincolors,
  2983.                               COLORSTRUCT *subcolors);
  2984.  
  2985.           Include        pictor.h
  2986.  
  2987.           Description    Runs the main menu specified by menu. maincolors
  2988.                          and subcolors point to COLORSTRUCT structures that
  2989.                          contain the colors used to display the mainmenu
  2990.                          and submenus respectively.
  2991.  
  2992.                          runmenu should be used in your program's main loop
  2993.                          (see the example program below). If the next
  2994.                          available keystroke is relevant to the current
  2995.                          menu context, it is processed by runmenu and 0 is
  2996.                          returned. Otherwise, the code for the keystroke is
  2997.                          returned so that it can be processed by your
  2998.                          program. See kbdread for a description of the
  2999.                          keyboard codes.
  3000.  
  3001.           Returns        The keyboard code if the last key pressed was not
  3002.                          processed by the main menu, or 0 if it was.
  3003.  
  3004.           See also       kbdread, showmenu
  3005.  
  3006.           Example
  3007.  
  3008.                /*
  3009.                ** RUNMENU.C: Demonstrates use of the PICTOR
  3010.                ** menu system.
  3011.                */
  3012.  
  3013.                #include <stdio.h>
  3014.                #include <pictor.h>
  3015.  
  3016.                /* set mainloop = FALSE to terminate main loop */
  3017.                int mainloop = TRUE;
  3018.  
  3019.                VIDEOSTRUCT vstruct;
  3020.                COLORSTRUCT menucolors = {
  3021.                   foreback(BLACK,CYAN),
  3022.                   foreback(BOLD+WHITE,CYAN),
  3023.                   foreback(BOLD+CYAN,BLUE),
  3024.  
  3025.  
  3026.  
  3027.                                          50
  3028.                           PICTOR User's Guide and Reference
  3029.  
  3030.  
  3031.                   foreback(BOLD+WHITE,BLUE)
  3032.                };
  3033.  
  3034.                /* give function references for menu tables */
  3035.                void sample(void);
  3036.                void terminate(void);
  3037.  
  3038.                SUBMENU filemenu[] = {
  3039.                   { "~New                F2",
  3040.                      "Create a new file",NULL,sample },
  3041.                   { "~Open...",
  3042.                      "Open an existing file",NULL,sample },
  3043.                   { "~Save",
  3044.                      "Save the current file",NULL,sample },
  3045.                   { "Save ~As",
  3046.                      "Save the current file with a different name",
  3047.                      NULL,sample },
  3048.                   SUBMENU_DIVIDER,
  3049.                   { "E~xit","Exit to DOS",NULL,terminate },
  3050.                   END_SUBMENU
  3051.                };
  3052.  
  3053.                SUBMENU editmenu[] = {
  3054.                   { "~Cut            Shift-Del",
  3055.                      "Move text to clipboard",NULL,sample },
  3056.                   { "C~opy",
  3057.                      "Copy text to clipboard",NULL,sample },
  3058.                   { "~Paste",
  3059.                      "Paste text from clipboard",NULL,sample },
  3060.                   END_SUBMENU
  3061.                };
  3062.  
  3063.                MAINMENU mainmenu[] = {
  3064.                   { "~File","File operations menu",NULL,filemenu },
  3065.                   { "~Edit","Edit operations menu",NULL,editmenu },
  3066.                   END_MAINMENU
  3067.                };
  3068.  
  3069.                void sample(void)
  3070.                {
  3071.                   beep();
  3072.                }
  3073.  
  3074.                void terminate(void)
  3075.                {
  3076.                   mainloop = FALSE;
  3077.                }
  3078.  
  3079.                void main()
  3080.                {
  3081.                   int i;
  3082.  
  3083.                   /* initialize library */
  3084.                   initvideo();
  3085.  
  3086.  
  3087.  
  3088.                                          51
  3089.                           PICTOR User's Guide and Reference
  3090.  
  3091.  
  3092.                   getvconfig(&vstruct);
  3093.  
  3094.                   /* hide text cursor */
  3095.                   showcurs(FALSE);
  3096.  
  3097.                   /* Default shadow color is white on black. Since */
  3098.                   /* our desktop is white on black, we need to make */
  3099.                   /* shadows darker in order for them to show up */
  3100.                   _PL_shadowcolor = foreback(BOLD+BLACK,BLACK);
  3101.  
  3102.                   /* create desktop */
  3103.                   for(i = 2;i < vstruct.rows;i++) {
  3104.                      setvpos(i,1);
  3105.                      vrepc('\xB1',vstruct.columns);
  3106.                   }
  3107.                   showmenu(mainmenu,&menucolors,FALSE);
  3108.                   initstatus(vstruct.rows,menucolors.normal);
  3109.                   statusbar("<Alt>=Menus  <F10>=Exit to DOS");
  3110.  
  3111.                   while(mainloop) {
  3112.                    switch(runmenu(mainmenu,&menucolors,&menucolors)) {
  3113.                         case 0:   /* keystroke processed by runmenu */
  3114.                            break;
  3115.                         case F2_KEY:
  3116.                            sample();
  3117.                            break;
  3118.                         case F10_KEY:
  3119.                            mainloop = FALSE;
  3120.                            break;
  3121.                         default:
  3122.                            beep();
  3123.                            break;
  3124.                      }
  3125.                   }
  3126.  
  3127.                   /* restore screen */
  3128.                   vcolor(foreback(WHITE,BLACK));
  3129.                   showcurs(TRUE);
  3130.                   cls();
  3131.                }
  3132.  
  3133.  
  3134.                          scroll
  3135.                          ---------------------------------------------
  3136.           Syntax         void scroll(int lines, int top, int left,
  3137.                               int height, int width);
  3138.  
  3139.           Include        pictor.h
  3140.  
  3141.           Description    This function scrolls the area described by top,
  3142.                          bottom, height, and width. lines specifies how far
  3143.                          each row is scrolled. If lines is positive the
  3144.                          area is scrolled up, if lines is negative the area
  3145.  
  3146.  
  3147.  
  3148.  
  3149.                                          52
  3150.                           PICTOR User's Guide and Reference
  3151.  
  3152.  
  3153.                          is scrolled down, and if lines is zero the
  3154.                          specified area is cleared.
  3155.  
  3156.           See also       cls, wclear
  3157.  
  3158.  
  3159.                          setcurs
  3160.                          ---------------------------------------------
  3161.           Syntax         void setcurs(int row, int column);
  3162.  
  3163.           Include        pictor.h
  3164.  
  3165.           Description    This function sets the position of the hardware
  3166.                          text cursor. Coordinates are 1-based so 1,1 refers
  3167.                          to the top, left corner of the screen. Note that
  3168.                          PICTOR routines use their own logical cursor and
  3169.                          are not effected by the location of the hardware
  3170.                          text cursor.
  3171.  
  3172.           See also       popcurs, pushcurs, setvpos, synccurs, setwpos
  3173.  
  3174.  
  3175.                          setcurstype
  3176.                          ---------------------------------------------
  3177.           Syntax         void setcurstype(int type);
  3178.  
  3179.           Include        pictor.h
  3180.  
  3181.           Description    Sets the starting and ending scan lines for the
  3182.                          hardware text cursor. The upper byte of type
  3183.                          specifies the starting scan line and the lower
  3184.                          byte specifies the ending scan line.
  3185.  
  3186.           See also       getcurstype, popcurs, pushcurs, showcurs
  3187.  
  3188.  
  3189.                          seterrorbeep
  3190.                          ---------------------------------------------
  3191.           Syntax         void seterrorbeep(int state);
  3192.  
  3193.           Include        pictor.h
  3194.  
  3195.           Description    The seterrorbeep enables or disables the beep
  3196.                          function. If state is FALSE, beep is disabled, if
  3197.                          state is TRUE, beep is enabled. Many PICTOR
  3198.                          library functions call beep to alert the user
  3199.                          (usually because an invalid key was pressed).
  3200.                          seterrorbeep effectively disables or enables error
  3201.                          beeping for these functions.
  3202.  
  3203.           See also       beep
  3204.  
  3205.  
  3206.                          setframe, setdoubleframe, setsingleframe
  3207.  
  3208.  
  3209.  
  3210.                                          53
  3211.                           PICTOR User's Guide and Reference
  3212.  
  3213.  
  3214.                          ---------------------------------------------
  3215.           Syntax         void setframe(char topbottom, char sides,
  3216.                               char topleft, char topright, char bottomleft,
  3217.                               char bottomright);
  3218.                          void setdoubleframe(void)
  3219.                          void setsingleframe(void);
  3220.  
  3221.           Include        pictor.h
  3222.  
  3223.           Description    The setframe routines describe the type of lines
  3224.                          used by the frame function. The arguments to
  3225.                          setframe specify the character to be used for each
  3226.                          of the frame elements: topbottom (top and bottom),
  3227.                          sides (left and right sides), topleft, topright,
  3228.                          bottomleft, and bottomright (the corners of the
  3229.                          frame). setdoubleframe and setsingleframe are
  3230.                          simply macros that call setframe with arguments
  3231.                          for a standard double-line frame and single-line
  3232.                          frame respectively.
  3233.  
  3234.                          Note that subsequent calls to frame will make use
  3235.                          of the modified frame style, including internal
  3236.                          library routines that call frame such as wopen and
  3237.                          runmenu.
  3238.  
  3239.           See also       frame
  3240.  
  3241.  
  3242.                          setvpos
  3243.                          ---------------------------------------------
  3244.           Syntax         void setvpos(int row, int column);
  3245.  
  3246.           Include        pictor.h
  3247.  
  3248.           Description    setvpos sets the logical cursor position. PICTOR
  3249.                          library routines use their own logical cursor
  3250.                          position instead of the hardware text cursor. Use
  3251.                          this function to set that position. row and column
  3252.                          are 1-based; therefore, the top, left corner of
  3253.                          the screen is at 1,1.
  3254.  
  3255.           See also       getvcol, getvrow, setcurs, syncvpos, setwpos
  3256.  
  3257.           Example        For an example of setvpos, please see the center
  3258.                          example.
  3259.  
  3260.  
  3261.                          setwpane
  3262.                          ---------------------------------------------
  3263.           Syntax         int setwpane(int handle);
  3264.  
  3265.           Include        pictor.h
  3266.  
  3267.  
  3268.  
  3269.  
  3270.  
  3271.                                          54
  3272.                           PICTOR User's Guide and Reference
  3273.  
  3274.  
  3275.           Description    This functions sets the active window pane for the
  3276.                          currently active window. handle is a handle that
  3277.                          was returned by wpane when the window pane was
  3278.                          created. Every window has at least one window
  3279.                          pane. The original pane (the only pane if the
  3280.                          window only has one) has a handle value of 0.
  3281.  
  3282.           Returns        TRUE if the specified window pane is successfully
  3283.                          selected, FALSE if handle is not a valid pane
  3284.                          handle.
  3285.  
  3286.           Also see       wpane
  3287.  
  3288.           Example        For an example of setwpane, please see the wpane
  3289.                          example.
  3290.  
  3291.  
  3292.                          setwpos
  3293.                          ---------------------------------------------
  3294.           Syntax         void setwpos(int row, int column);
  3295.  
  3296.           Include        pictor.h
  3297.  
  3298.           Description    The setwpos function sets the logical window
  3299.                          position for the active window pane. This
  3300.                          determines the location of the next write using
  3301.                          any of the window output functions. It also
  3302.                          positions the hardware text cursor if the window
  3303.                          was created with the WO_TEXTCURSOR attribute.
  3304.                          Window pane coordinates are 1-based so 1,1
  3305.                          specifies the top, left corner of the window pane.
  3306.  
  3307.           See also       setcurs, setvpos
  3308.  
  3309.  
  3310.                          showcurs
  3311.                          ---------------------------------------------
  3312.           Syntax         void showcurs(int state);
  3313.  
  3314.           Include        pictor.h
  3315.  
  3316.           Description    Displays or hides the text cursor. The cursor is
  3317.                          hidden if state is FALSE, restored if it is TRUE.
  3318.                          This function modifies the cursor's starting and
  3319.                          ending scan lines and may not work on every
  3320.                          display. A more reliable way to hide the cursor
  3321.                          may be to position it off the screen. For example,
  3322.                          on a 25x80 display, use setcurs(26,1).
  3323.  
  3324.           See also       setcurs, setcurstype
  3325.  
  3326.  
  3327.                          showmenu
  3328.                          ---------------------------------------------
  3329.  
  3330.  
  3331.  
  3332.                                          55
  3333.                           PICTOR User's Guide and Reference
  3334.  
  3335.  
  3336.           Syntax         void showmenu(MAINMENU *menu, COLORSTRUCT *colors,
  3337.                               int highlight);
  3338.  
  3339.           Include        pictor.h
  3340.  
  3341.           Description    Displays the main menu specified by menu across
  3342.                          the top of the screen. highlight specifies if the
  3343.                          main menu hotkeys (those letters preceded by a
  3344.                          tilde (~) character) are displayed using the bold
  3345.                          attribute specified in the colors structure. If
  3346.                          highlight is TRUE, the hotkeys are highlighted;
  3347.                          otherwise, they aren't.
  3348.  
  3349.           See also       runmenu
  3350.  
  3351.           Example        For an example of showmenu, please see the runmenu
  3352.                          example.
  3353.  
  3354.                          
  3355.                          snowcheckoff
  3356.                          ---------------------------------------------
  3357.           Syntax         void snowcheckoff(void);
  3358.  
  3359.           Include        pictor.h
  3360.  
  3361.           Description    Many older CGA displays will snow (flicker random
  3362.                          white spots) when the screen is accessed too
  3363.                          quickly. If initvideo determines that a CGA is the
  3364.                          active adapter, it enables snow checking which
  3365.                          slows down screen access in a manner that
  3366.                          eliminates snow. Some newer CGA's do not snow, and
  3367.                          some users of older CGA's may prefer snow to the
  3368.                          slower performance resulting from snow checking.
  3369.                          Therefore, the snowcheckoff macro is provided so
  3370.                          that snow checking can be disabled. snowcheckoff
  3371.                          has no effect if the current display adapter is
  3372.                          not a CGA.
  3373.  
  3374.  
  3375.                          statusbar
  3376.                          ---------------------------------------------
  3377.           Syntax         void statusbar(char *string);
  3378.  
  3379.           Include        pictor.h
  3380.  
  3381.           Description    Displays string on the status bar.
  3382.  
  3383.           See also       clrstatus, initstatus
  3384.  
  3385.  
  3386.                          synccurs
  3387.                          ---------------------------------------------
  3388.           Syntax         void synccurs(void);
  3389.  
  3390.  
  3391.  
  3392.  
  3393.                                          56
  3394.                           PICTOR User's Guide and Reference
  3395.  
  3396.  
  3397.           Include        pictor.h
  3398.  
  3399.           Description    This function positions the hardware text cursor
  3400.                          so that it matches the current logical cursor
  3401.                          position.
  3402.  
  3403.           See also       syncvpos
  3404.  
  3405.  
  3406.                          syncvpos
  3407.                          ---------------------------------------------
  3408.           Syntax         void syncvpos(void);
  3409.  
  3410.           Include        pictor.h
  3411.  
  3412.           Description    This function positions the logical cursor so that
  3413.                          it matches the hardware text cursor.
  3414.  
  3415.           See also       synccurs
  3416.  
  3417.  
  3418.                          tone
  3419.                          ---------------------------------------------
  3420.           syntax         void tone(int freq, int duration);
  3421.  
  3422.           Include        pictor.h
  3423.  
  3424.           Description    Sounds the computer's internal speaker. freq
  3425.                          specifies the sound's frequency in cycles per
  3426.                          second. duration specifies how long to play the
  3427.                          tone. Each count of duration is equal to about an
  3428.                          18th of a second (a duration of 18 is just under 1
  3429.                          second).
  3430.  
  3431.                          If you want to sound the computer's internal
  3432.                          speaker to alert the user in a manner that is
  3433.                          consistent with the way many of the internal
  3434.                          library routines do, use the beep function which,
  3435.                          in turn, calls tone. Using beep also allows your
  3436.                          program to disable all warning beeps with a single
  3437.                          call to seterrorbeep.
  3438.  
  3439.           See also       beep
  3440.  
  3441.           Example
  3442.  
  3443.                /*
  3444.                ** TONE.C: Plays a series of tones.
  3445.                */
  3446.  
  3447.                #include <pictor.h>
  3448.  
  3449.                void main()
  3450.                {
  3451.  
  3452.  
  3453.  
  3454.                                          57
  3455.                           PICTOR User's Guide and Reference
  3456.  
  3457.  
  3458.                   int i;
  3459.  
  3460.                   for(i = 110;i <= 880;i += 20)
  3461.                      tone(i,1);
  3462.  
  3463.                   for( ;i >= 110;i -= 20)
  3464.                      tone(i,1);
  3465.                }
  3466.  
  3467.  
  3468.                          uncompress
  3469.                          ---------------------------------------------
  3470.           Syntax         void uncompress(BYTE *inbuff, WORD len,
  3471.                               BYTE *outbuff, NODE *rootnode);
  3472.  
  3473.           Include        compress.h
  3474.  
  3475.           Description    Uncompresses data that was compressed using
  3476.                          compress. inbuff is a pointer to a buffer with the
  3477.                          compressed data. len specifies the length of the
  3478.                          uncompressed (output) data. outbuff is where the
  3479.                          uncompressed data will be written and must be big
  3480.                          enough to hold len characters. rootnode points to
  3481.                          the compression code tree used to compress the
  3482.                          data. Note: rootnode must point to the same code
  3483.                          tree used to compress the data or uncompress will
  3484.                          fail.
  3485.  
  3486.           See also       compress, freetree, gettree, readtree, writetree
  3487.  
  3488.           Example
  3489.  
  3490.                /*
  3491.                ** UNCOMP.C: Uncompresses a file that was compressed
  3492.                ** with COMPRESS.C.
  3493.                */
  3494.  
  3495.                #include <stdio.h>
  3496.                #include <string.h>
  3497.                #include <compress.h>
  3498.  
  3499.                BYTE inbuff[BUFSIZ + 200];
  3500.                BYTE outbuff[BUFSIZ];
  3501.  
  3502.                void main(int argc,char *argv[])
  3503.                {
  3504.                   FILE *istream,*ostream;
  3505.                   WORD complen,uncomplen;
  3506.                   NODE *rootnode;
  3507.  
  3508.                   /* check arguments */
  3509.                   if(argc != 3 || !stricmp(argv[1],argv[2])) {
  3510.                      printf("Usage:\tUNCOMP <infile> <outfile>\n");
  3511.                      return;
  3512.  
  3513.  
  3514.  
  3515.                                          58
  3516.                           PICTOR User's Guide and Reference
  3517.  
  3518.  
  3519.                   }
  3520.  
  3521.                   /* open files */
  3522.                   istream = fopen(argv[1],"rb");
  3523.                   ostream = fopen(argv[2],"wt");
  3524.                   if(istream == NULL || ostream == NULL) {
  3525.                      printf("File error\n");
  3526.                      return;
  3527.                   }
  3528.  
  3529.                   /* read and uncompress code tree */
  3530.                   complen = getw(istream);
  3531.                   fread(inbuff,sizeof(BYTE),complen,istream);
  3532.                   rootnode = readtree(inbuff);
  3533.                   if(rootnode == NULL) {
  3534.                      printf("Out of memory\n");
  3535.                      return;
  3536.                   }
  3537.  
  3538.                   /* uncompress data and write to file */
  3539.                   while((uncomplen = getw(istream)) != 0) {
  3540.                      complen = getw(istream);
  3541.                      fread(inbuff,sizeof(BYTE),complen,istream);
  3542.                      uncompress(inbuff,uncomplen,outbuff,rootnode);
  3543.                      fwrite(outbuff,sizeof(BYTE),uncomplen,ostream);
  3544.                   }
  3545.  
  3546.                   fclose(istream);
  3547.                   fclose(ostream);
  3548.                }
  3549.  
  3550.  
  3551.                          unhookints
  3552.                          ---------------------------------------------
  3553.           Syntax         int unhookints(void);
  3554.  
  3555.           Include        pictor.h
  3556.  
  3557.           Description    This function uninstalls the Ctrl-C, Ctrl-Break
  3558.                          and critical error handlers that were previously
  3559.                          installed by hookints. Since hookints registers
  3560.                          unhookints with the ANSI C library function
  3561.                          atexit, you do not need to call this function.
  3562.                          However, you can call it if you want to restore
  3563.                          the handlers before your program terminates. There
  3564.                          is no ill-effect from calling unhookints multiple
  3565.                          times.
  3566.  
  3567.           Returns        0 if successful or -1 if an error occurred.
  3568.  
  3569.           See also       hookints
  3570.  
  3571.  
  3572.                          vcolor
  3573.  
  3574.  
  3575.  
  3576.                                          59
  3577.                           PICTOR User's Guide and Reference
  3578.  
  3579.  
  3580.                          ---------------------------------------------
  3581.           Syntax         void vcolor(int color);
  3582.  
  3583.           Include        pictor.h
  3584.  
  3585.           Description    Selects the default colors for routines that write
  3586.                          to the screen. Note that a number of library
  3587.                          routines call this function and change the default
  3588.                          colors so you should call vcolor just before
  3589.                          writing to the screen. Use wcolor to change the
  3590.                          default color for the current window pane.
  3591.  
  3592.           See also       foreback, wcolor
  3593.  
  3594.  
  3595.                          vgetca
  3596.                          ---------------------------------------------
  3597.           Syntax         int vgetca(void);
  3598.  
  3599.           Include        pictor.h
  3600.  
  3601.           Description    This function returns the character and attribute
  3602.                          from the screen at the current logical cursor
  3603.                          position. The low byte contains the character and
  3604.                          the upper byte contains the attribute.
  3605.  
  3606.           Returns        The character and attribute as described above.
  3607.  
  3608.           See also       vputca
  3609.  
  3610.  
  3611.                          vputa
  3612.                          ---------------------------------------------
  3613.           Syntax         void vputa(int color);
  3614.  
  3615.           Include        pictor.h
  3616.  
  3617.           Description    This function writes the color attribute color to
  3618.                          the screen at the current logical position without
  3619.                          disturbing the text at that location.
  3620.  
  3621.           See also       vrepa
  3622.  
  3623.  
  3624.                          vputc
  3625.                          ---------------------------------------------
  3626.           Syntax         void vputc(char c);
  3627.  
  3628.           Include        pictor.h
  3629.  
  3630.           Description    vputc writes the character c to the screen at the
  3631.                          current logical cursor position using the current
  3632.                          default colors.
  3633.  
  3634.  
  3635.  
  3636.  
  3637.                                          60
  3638.                           PICTOR User's Guide and Reference
  3639.  
  3640.  
  3641.           See also       setvpos, vcolor, wputc
  3642.  
  3643.  
  3644.                          vputca
  3645.                          ---------------------------------------------
  3646.           Syntax         void vputca(int value);
  3647.  
  3648.           Include        pictor.h
  3649.  
  3650.           Description    This function writes a character and color
  3651.                          attribute to the screen at the current logical
  3652.                          cursor position. The low byte of value should
  3653.                          contain the character and the high byte should
  3654.                          contain the attribute.
  3655.  
  3656.           See also       vgetca, vputc
  3657.  
  3658.  
  3659.                          vputs
  3660.                          ---------------------------------------------
  3661.           Syntax         void vputs(char *string);
  3662.  
  3663.           Include        pictor.h
  3664.  
  3665.           Description    vputs writes a null-terminated string to the
  3666.                          screen at the current logical cursor position.
  3667.  
  3668.           See also       wputs, xprintf
  3669.  
  3670.           Example        For an example of vputs, please see the center
  3671.                          example.
  3672.  
  3673.  
  3674.                          vrepa
  3675.                          ---------------------------------------------
  3676.           Syntax         void vrepa(int color, int count);
  3677.  
  3678.           Include        pictor.h
  3679.  
  3680.           Description    This function writes the color attribute specified
  3681.                          by color for the number of columns specified by
  3682.                          count without disturbing the text at that
  3683.                          location. This function is useful for creating
  3684.                          highlight bars.
  3685.  
  3686.           See also       vputa, wrepa
  3687.  
  3688.  
  3689.                          vrepc
  3690.                          ---------------------------------------------
  3691.           Syntax         void vrepc(char c, int count);
  3692.  
  3693.           Include        pictor.h
  3694.  
  3695.  
  3696.  
  3697.  
  3698.                                          61
  3699.                           PICTOR User's Guide and Reference
  3700.  
  3701.  
  3702.           Description    This function writes c to the screen using vputc
  3703.                          for the number of times specified by count.
  3704.  
  3705.           See also       vputc, wrepc
  3706.  
  3707.  
  3708.                          wclear
  3709.                          ---------------------------------------------
  3710.           Syntax         void wclear(void);
  3711.  
  3712.           Include        pictor.h
  3713.  
  3714.           Description    This function clears the contents of the active
  3715.                          window pane and homes the window's logical cursor
  3716.                          (and the hardware text cursor if the window was
  3717.                          created with the WO_TEXTCURSOR attribute). wclear
  3718.                          is always called by wopen when a new window or
  3719.                          window pane is created.
  3720.  
  3721.           See also       cls, scroll
  3722.  
  3723.  
  3724.                          wcleareol
  3725.                          ---------------------------------------------
  3726.           Syntax         void wcleareol(void);
  3727.  
  3728.           Include        pictor.h
  3729.  
  3730.           Description    This function clears from the current window pane
  3731.                          position to the end of the window pane. Unlike the
  3732.                          cleareol function, wcleareol does not update the
  3733.                          window pane's logical cursor position.
  3734.  
  3735.           See also       cleareol, wclear
  3736.  
  3737.  
  3738.                          wclose
  3739.                          ---------------------------------------------
  3740.           Syntax         void wclose(void);
  3741.  
  3742.           Include        pictor.h
  3743.  
  3744.           Description    This function closes the active window and frees
  3745.                          memory associated with it. If another window was
  3746.                          underneath the active window, that window then
  3747.                          becomes the active window.
  3748.  
  3749.           See also       wcloseall, wopen
  3750.  
  3751.           Example        For an example of wclose, please see the wopen
  3752.                          example.
  3753.  
  3754.  
  3755.                          wcloseall
  3756.  
  3757.  
  3758.  
  3759.                                          62
  3760.                           PICTOR User's Guide and Reference
  3761.  
  3762.  
  3763.                          ---------------------------------------------
  3764.           Syntax         void wcloseall(void);
  3765.  
  3766.           Include        pictor.h
  3767.  
  3768.           Description    This function closes all open windows and frees
  3769.                          memory associated with them.
  3770.  
  3771.           See also       wclose
  3772.  
  3773.  
  3774.                          wcolor
  3775.                          ---------------------------------------------
  3776.           Syntax         void wcolor(int color);
  3777.  
  3778.           Include        pictor.h
  3779.  
  3780.           Description    This function changes the default color attribute
  3781.                          for the active window pane to color. The window
  3782.                          does not change appearance when this function is
  3783.                          called. Instead, it sets the attribute to be used
  3784.                          the next time the window pane is written to.
  3785.  
  3786.           See also       foreback, vcolor
  3787.  
  3788.  
  3789.                          wopen
  3790.                          ---------------------------------------------
  3791.           Syntax         int wopen(int top, int left, int height,
  3792.                               int width, int color, int flags);
  3793.  
  3794.           Include        pictor.h
  3795.  
  3796.           Description    Creates and displays a new window. The first four
  3797.                          arguments specify the location and size of the
  3798.                          window. Note that since the window has a border,
  3799.                          the window's display area is actually (height - 2)
  3800.                          (width - 2). color specifies the window's color
  3801.                          attribute. flags specifies optional window
  3802.                          attributes. flags should be 0x00 if the window has
  3803.                          no optional attributes, and multiple attributes
  3804.                          can be combined using a bitwise OR (▌). flags can
  3805.                          be any of the following constants defined in
  3806.                          PICTOR.H:
  3807.  
  3808.                          Constant       Meaning
  3809.                          ---------------------------------------------
  3810.                          WO_SHADOW      The window will be displayed with a
  3811.                                         shadow.
  3812.                          WO_STATICMEM   Causes wopen to allocate memory for
  3813.                                         the window from an internal static
  3814.                                         buffer instead of dynamically
  3815.                                         allocating memory using malloc. You
  3816.                                         should avoid using this flag since
  3817.  
  3818.  
  3819.  
  3820.                                          63
  3821.                           PICTOR User's Guide and Reference
  3822.  
  3823.  
  3824.                                         the static buffer is relatively
  3825.                                         small. Also, windows that have the
  3826.                                         WO_STATICMEM attribute cannot have
  3827.                                         multiple panes. This flag is used
  3828.                                         by some of the library routines
  3829.                                         such as messagebox so that they can
  3830.                                         display errors when there is no
  3831.                                         more system memory, and so that
  3832.                                         they can be called from interrupt
  3833.                                         handlers (which should never call
  3834.                                         malloc). If the WO_STATICMEM
  3835.                                         attribute is specified and wopen
  3836.                                         cannot allocate enough memory from
  3837.                                         the static buffer for the window
  3838.                                         buffer, the screen beneath the
  3839.                                         window will not be saved and the
  3840.                                         window will still appear after it
  3841.                                         has been closed. If wopen cannot
  3842.                                         allocate enough static memory even
  3843.                                         for the window structure itself,
  3844.                                         wopen terminates the program by
  3845.                                         displaying an error message and
  3846.                                         calling exit. wopen never returns
  3847.                                         FALSE when WO_STATICMEM is
  3848.                                         specified.
  3849.                          WO_TEXTCURSOR  This gives the window a hardware
  3850.                                         text cursor. The cursor position is
  3851.                                         updated whenever the window pane's
  3852.                                         logical cursor position changes.
  3853.                          WO_TEXTWRAP    Normally, text that extends beyond
  3854.                                         the edge of the window is clipped
  3855.                                         (not displayed). If the WO_TEXTWRAP
  3856.                                         attribute is specified, characters
  3857.                                         that extend beyond the edge of the
  3858.                                         window wrap around to appear at the
  3859.                                         beginning of the next line.
  3860.  
  3861.           Returns        TRUE if the window was successfully created and
  3862.                          displayed, FALSE if there is not enough memory to
  3863.                          create the window.
  3864.  
  3865.           See also       wclose, wtitle
  3866.  
  3867.           Example
  3868.  
  3869.                /*
  3870.                ** WOPEN.C: Creates a window and displays some text in it.
  3871.                */
  3872.  
  3873.                #include <pictor.h>
  3874.  
  3875.                void main()
  3876.                {
  3877.                   /* initialize library */
  3878.  
  3879.  
  3880.  
  3881.                                          64
  3882.                           PICTOR User's Guide and Reference
  3883.  
  3884.  
  3885.                   initvideo();
  3886.                   vcolor(foreback(BOLD+WHITE,BLUE)); cls();
  3887.  
  3888.                   /* create a window and write some text in it */
  3889.                   wopen(5,6,17,70,foreback(BLACK,WHITE),WO_SHADOW);
  3890.                   wputs("Hello, world. wputs() here!\n\nPress any key");
  3891.  
  3892.                   /* wait for user to press a key */
  3893.                   kbdread();
  3894.                   wclose();
  3895.  
  3896.                   /* restore screen */
  3897.                   vcolor(foreback(WHITE,BLACK));
  3898.                   cls();
  3899.                }
  3900.  
  3901.  
  3902.                          wpane
  3903.                          ---------------------------------------------
  3904.           Syntax         int wpane(int direction, int position);
  3905.  
  3906.           Include        pictor.h
  3907.  
  3908.           Description    Splits the active window pane into two panes.
  3909.                          direction specifies the direction of the split and
  3910.                          can be any one of the following constants defined
  3911.                          in PICTOR.H:
  3912.  
  3913.                          Constant       Meaning
  3914.                          ---------------------------------------------
  3915.                          WP_VERTICAL    The current window pane is split
  3916.                                         vertically.
  3917.                          WP_HORIZONTAL  The current window pane is split
  3918.                                         horizontally.
  3919.  
  3920.                          position is the column to split the window if
  3921.                          direction is WP_VERTICAL, or the row to split the
  3922.                          window if direction is WP_HORIZONTAL.
  3923.  
  3924.                          When a window is created using wopen, it has a
  3925.                          single pane that is as big as the window minus the
  3926.                          window frame. The original pane always has a
  3927.                          handle value of 0. wpane divides the current
  3928.                          window pane into two panes and returns a handle to
  3929.                          the new pane. The new pane is considered to be the
  3930.                          pane on the right if direction is WP_VERTICAL, or
  3931.                          the pane on the bottom if direction is
  3932.                          WP_HORIZONTAL. The handle returned by this
  3933.                          function can be passed to setwpane to make the new
  3934.                          window pane active.
  3935.  
  3936.                          If creating the new window pane would result in
  3937.                          either the new window pane or the window pane
  3938.                          being split having less than 3 rows or 3 columns
  3939.  
  3940.  
  3941.  
  3942.                                          65
  3943.                           PICTOR User's Guide and Reference
  3944.  
  3945.  
  3946.                          (1 row or column inside the pane's border), wpane
  3947.                          refuses to create the new pane and an error is
  3948.                          returned.
  3949.  
  3950.           Returns        The handle to the new window pane as described
  3951.                          above if successful, or 0 if an error occurred.
  3952.  
  3953.           See also       setwpane
  3954.  
  3955.           Example
  3956.  
  3957.                /*
  3958.                ** WPANE.C: Divides a window into many panes.
  3959.                */
  3960.  
  3961.                #include <pictor.h>
  3962.  
  3963.                void main()
  3964.                {
  3965.                   int i,handle1,handle2;
  3966.  
  3967.                   /* initialize library */
  3968.                   initvideo();
  3969.  
  3970.                   wopen(5,6,17,70,foreback(BOLD+CYAN,BLUE),0x00);
  3971.  
  3972.                   handle1 = 0;
  3973.                   handle2 = wpane(WP_VERTICAL,35);
  3974.  
  3975.                   for(i = 0;i < 8;i++) {
  3976.                      setwpane(handle1);
  3977.                      xprintf(wputs,"Pane handle: %d",handle1);
  3978.                      handle1 = wpane(WP_HORIZONTAL,3);
  3979.  
  3980.                      setwpane(handle2);
  3981.                      xprintf(wputs,"Pane handle: %d",handle2);
  3982.                      handle2 = wpane(WP_HORIZONTAL,3);
  3983.                   }
  3984.                   kbdread();
  3985.                   wclose();
  3986.                }
  3987.  
  3988.  
  3989.                          wputc
  3990.                          ---------------------------------------------
  3991.           Syntax         void wputc(char c);
  3992.  
  3993.           Include        pictor.h
  3994.  
  3995.           Description    Writes c to the active window pane. c is written
  3996.                          at the location of the active window pane's
  3997.                          logical cursor position using the current window
  3998.                          pane color. Characters extending beyond the edge
  3999.                          of the window pane using wputc are clipped.
  4000.  
  4001.  
  4002.  
  4003.                                          66
  4004.                           PICTOR User's Guide and Reference
  4005.  
  4006.  
  4007.  
  4008.           See also       setwpos, vputc, wrepc
  4009.  
  4010.  
  4011.                          wputs
  4012.                          ---------------------------------------------
  4013.           Syntax         void wputs(char *string);
  4014.  
  4015.           Include        pictor.h
  4016.  
  4017.           Description    Writes string to the active window pane. string is
  4018.                          written starting at the location of the active
  4019.                          window pane's logical cursor position using the
  4020.                          current window pane color. Characters extending
  4021.                          beyond the edge of the window pane are clipped.
  4022.  
  4023.           See also       setwpos, vputs, xprintf
  4024.  
  4025.           Example        For an example of wputs, please see the wopen
  4026.                          example.
  4027.  
  4028.  
  4029.                          wrepa
  4030.                          ---------------------------------------------
  4031.           Syntax         void wrepa(int color, int count);
  4032.  
  4033.           Include        pictor.h
  4034.  
  4035.           Description    Writes the color attribute specified by color to
  4036.                          the active window pane and repeats it for the
  4037.                          number of times specified by count. Printing
  4038.                          begins at the window pane's logical cursor
  4039.                          position. If count extends beyond the edge of the
  4040.                          window pane, the output is clipped.
  4041.  
  4042.           See also       vrepa, setwpos
  4043.  
  4044.  
  4045.                          wrepc
  4046.                          ---------------------------------------------
  4047.           Syntax         void wrepc(char c, int count);
  4048.  
  4049.           Include        pictor.h
  4050.  
  4051.           Description    Writes c to the active window pane for the number
  4052.                          of times specified by count. Printing begins at
  4053.                          the window pane's logical cursor position.
  4054.                          Characters extending beyond the edge of the window
  4055.                          pane are clipped.
  4056.  
  4057.           See also       vrepc, setwpos
  4058.  
  4059.  
  4060.                          writetree
  4061.  
  4062.  
  4063.  
  4064.                                          67
  4065.                           PICTOR User's Guide and Reference
  4066.  
  4067.  
  4068.                          ---------------------------------------------
  4069.           Syntax         WORD writetree(NODE *rootnode, BYTE *buffer);
  4070.  
  4071.           Include        compress.h
  4072.  
  4073.           Description    Writes the compression code tree specified by
  4074.                          rootnode to buffer. The code tree is written so as
  4075.                          to take the minimum number of bytes necessary.
  4076.                          This function is suitable for writing a
  4077.                          compression code tree to a buffer so that it can
  4078.                          be written to a file. The data can later to
  4079.                          converted back to a code tree using readtree. The
  4080.                          required length of buffer varies depending on the
  4081.                          number of characters included in the code tree. A
  4082.                          typical value might be around 90 bytes. Since you
  4083.                          don't know how many bytes will be required, you
  4084.                          should be sure to use a buffer that is larger than
  4085.                          the typical value.
  4086.  
  4087.           Returns        The number of bytes that were written to buffer.
  4088.  
  4089.           See also       compress, freetree, gettree, readtree, uncompress
  4090.  
  4091.           Example        For an example of writetree, please see the
  4092.                          compress example.
  4093.  
  4094.  
  4095.                          wsynccurs
  4096.                          ---------------------------------------------
  4097.           Syntax         void wsynccurs(void);
  4098.  
  4099.           Include        pictor.h
  4100.  
  4101.           Description    This function synchronizes the hardware text
  4102.                          cursor position with the current window pane's
  4103.                          logical cursor position. The cursor is moved
  4104.                          inside the window so that its location matches
  4105.                          where text will be written with the next call to a
  4106.                          window output function. If the current window
  4107.                          pane's logical cursor position is not within the
  4108.                          current window pane, the hardware text cursor is
  4109.                          hidden.
  4110.  
  4111.           See also       synccurs, syncvpos
  4112.  
  4113.  
  4114.                          wtitle
  4115.                          ---------------------------------------------
  4116.           Syntax         void wtitle(char *string);
  4117.  
  4118.           Include        pictor.h
  4119.  
  4120.  
  4121.  
  4122.  
  4123.  
  4124.  
  4125.                                          68
  4126.                           PICTOR User's Guide and Reference
  4127.  
  4128.  
  4129.           Description    Gives the active window pane a title by printing
  4130.                          string centered across the top of the window pane.
  4131.                          If string is NULL, the current title is cleared.
  4132.  
  4133.  
  4134.                          xprintf
  4135.                          ---------------------------------------------
  4136.           Syntax         void xprintf(void (*func)(), char *format
  4137.                               [, arguments ]...);
  4138.  
  4139.           Include        pictor.h
  4140.  
  4141.           Description    This function formats a string and sends it to any
  4142.                          function that takes a single string as an
  4143.                          argument. xprintf creates a formatted string using
  4144.                          format and arguments and sends the result to func.
  4145.                          The syntax is the same as for the ANSI C library
  4146.                          function fprintf, but instead if the first
  4147.                          argument specifying a stream, the first argument
  4148.                          specifies a function.
  4149.  
  4150.                          xprintf is designed to handle strings that fit on
  4151.                          one line of the display. Creating lines that are
  4152.                          longer than 132 characters will overflow the
  4153.                          internal buffer.
  4154.  
  4155.           Example
  4156.  
  4157.                /*
  4158.                ** XPRINTF.C: Displays a window with information about
  4159.                ** the current display configuration.
  4160.                */
  4161.  
  4162.                #include <pictor.h>
  4163.  
  4164.                void main()
  4165.                {
  4166.                   VIDEOSTRUCT vstruct;
  4167.  
  4168.                   /* initialize library */
  4169.                   initvideo();
  4170.                   getvconfig(&vstruct);
  4171.  
  4172.                   /* create window and write information */
  4173.                   wopen(6,11,11,60,foreback(BOLD+WHITE,BLUE),0x00);
  4174.                   xprintf(wputs,"Video segment: %04X\n",
  4175.                      vstruct.segment);
  4176.                   xprintf(wputs,"Snow checking: %s\n",
  4177.                      (vstruct.snowcheck) ? "On" : "Off");
  4178.                   xprintf(wputs,"Text rows: %d\n",vstruct.rows);
  4179.                   xprintf(wputs,"Text columns: %d\n",vstruct.columns);
  4180.                   xprintf(wputs,"Video mode: %d\n",vstruct.mode);
  4181.                   xprintf(wputs,"Display page: %d\n",vstruct.page);
  4182.                   xprintf(wputs,"Color support: %s\n",
  4183.  
  4184.  
  4185.  
  4186.                                          69
  4187.                           PICTOR User's Guide and Reference
  4188.  
  4189.  
  4190.                      (vstruct.colorsupport) ? "Yes" : "No");
  4191.                   wputs("\nPress any key...");
  4192.  
  4193.                   /* wait for user to press a key and close window */
  4194.                   kbdread();
  4195.                   wclose();
  4196.                }
  4197.  
  4198.  
  4199.  
  4200.           VARIABLES
  4201.           -------------------------------------------------------------
  4202.           There are a number of variables that are used internally by the
  4203.           PICTOR library. Normally, these variables are set through
  4204.           function calls or through macros. We don't recommend directly
  4205.           accessing those variables that can be accessed through functions
  4206.           or macros. However, since the source code is provided with this
  4207.           package, these variables are documented here in case you need
  4208.           them.
  4209.  
  4210.           These variables all begin with _PL_ to indicate that they are
  4211.           PICTOR Library variables and to minimize the chances of conflict
  4212.           with symbol names in your application.
  4213.  
  4214.           Variable                 Description
  4215.           ------------------------------------------------------------
  4216.           int _PL_beepfreq         Specifies the frequency argument passed
  4217.                                    to tone by the beep function. Default
  4218.                                    value: 880.
  4219.           int _PL_beeplen          Specifies the duration argument passed
  4220.                                    to tone by the beep function. Default
  4221.                                    value: 2.
  4222.           int _PL_breakflag        Set by the hookints function's Ctrl-
  4223.                                    Break handler when the user presses
  4224.                                    <Ctrl-Break>.
  4225.           int _PL_color            Internal color attribute. Set by vcolor.
  4226.           int _PL_colorsupport     TRUE if the host display supports color.
  4227.                                    One of the values returned by
  4228.                                    getvconfig.
  4229.           int _PL_columns          The number of screen columns. One of the
  4230.                                    values returned by getvconfig.
  4231.           int _PL_comoverflow      Set to a non-zero value if the
  4232.                                    communications' receive buffer
  4233.                                    overflows. Set to 0 by comflush.
  4234.           int _PL_comtimeout       Number of 18ths of a second allowed
  4235.                                    between characters by the serial
  4236.                                    communications' input and output
  4237.                                    routines. Set by comsettimeout and
  4238.                                    returned by comgettimeout.
  4239.           int _PL_editfill         Character used by kbdedit to fill blank
  4240.                                    edit columns. Default value: '\xFA'.
  4241.           int _PL_errorbeep        The beep function beeps only if this
  4242.                                    variable is non-zero. Set by
  4243.                                    seterrorbeep.
  4244.  
  4245.  
  4246.  
  4247.                                          70
  4248.                           PICTOR User's Guide and Reference
  4249.  
  4250.  
  4251.           int _PL_escape           TRUE if the last key returned by kbdread
  4252.                                    was the Escape key. This is the value
  4253.                                    returned by escpressed.
  4254.           char *_PL_helpcontext    Pointer to the help topic string used by
  4255.                                    some library routines that pass it to
  4256.                                    helprun. Set by helpsetcontext and
  4257.                                    returned by helpgetcontext.
  4258.           int (*_PL_helpfunc)();   Points to helprun if help has been
  4259.                                    activated, or is set to NULL if help is
  4260.                                    not activated. This variable is set and
  4261.                                    cleared by helpopen and helpclose
  4262.                                    respectively. Library functions that
  4263.                                    access the help system check this
  4264.                                    variable to see if help is active. This
  4265.                                    allows these functions to access help
  4266.                                    without causing the help routines to be
  4267.                                    linked into your program if your program
  4268.                                    doesn't activate help.
  4269.           int _PL_lbcols           Specifies the number of columns in the
  4270.                                    list box created by listbox.
  4271.           int _PL_lbcolwidth       Specifies the width of each column in
  4272.                                    the list box created by listbox.
  4273.           int _PL_lbrows           Specifies the number of rows in the list
  4274.                                    box created by listbox.
  4275.           int _PL_menurow          Determines the screen row used for the
  4276.                                    pulldown menus. Default value: 1.
  4277.           int _PL_mode             The current video mode. One of the
  4278.                                    values returned by getvconfig.
  4279.           int _PL_offset           Screen offset used by library routines
  4280.                                    that write to the display. This variable
  4281.                                    is set by setvpos. It is used in
  4282.                                    combination with _PL_segment to
  4283.                                    calculated the screen address when
  4284.                                    writing to the display.
  4285.           int _PL_page             The current video display page. One of
  4286.                                    the values returned by getvconfig.
  4287.           int _PL_pushedkey        Variable to store the keystroke pushed
  4288.                                    by kbdpush. The variable is set to 0 by
  4289.                                    kbdread.
  4290.           int _PL_rows             Number of screen rows. One of the values
  4291.                                    returned by getvconfig.
  4292.           int _PL_segment          Display segment. This variable is used
  4293.                                    in combination with _PL_offset to
  4294.                                    calculate the screen address when
  4295.                                    writing to the display. One of the
  4296.                                    values returned by getvconfig.
  4297.           int _PL_shadowcolor      Color attribute used to create window
  4298.                                    shadows. When a window is created with
  4299.                                    the WO_SHADOW attribute, this attribute
  4300.                                    is written along the bottom and right
  4301.                                    side of the window. The default value is
  4302.                                    foreback(WHITE, BLACK) (0x07). You may
  4303.                                    want to set this variable to
  4304.                                    foreback(BOLD+BLACK, BLACK) (0x08) for a
  4305.  
  4306.  
  4307.  
  4308.                                          71
  4309.                           PICTOR User's Guide and Reference
  4310.  
  4311.  
  4312.                                    darker shadow, but note that some non-
  4313.                                    color systems cannot display bold
  4314.                                    attributes.
  4315.           int _PL_snowcheck        TRUE if the activate display adapter is
  4316.                                    a CGA. One of the values returned by
  4317.                                    getvconfig. Set to FALSE by
  4318.                                    snowcheckoff. Warning: Setting this
  4319.                                    variable to TRUE can cause unpredictable
  4320.                                    results if the active display adapter is
  4321.                                    not CGA compatible.
  4322.           int _PL_statusrow        Row used to display the status bar. Set
  4323.                                    by initstatus.
  4324.           int _PL_tabendedit       If this variable is TRUE, kbdedit will
  4325.                                    act as though <Enter> was pressed when
  4326.                                    the user presses <Tab> or <Shift-Tab>.
  4327.                                    This variable is used by multiedit to
  4328.                                    allow the user to tab between edit
  4329.                                    fields.
  4330.           WINDOW *_PL_winhead      Pointer to the active window or NULL if
  4331.                                    no windows are active.
  4332.           int _PL_wintab           Specifies the tab displacement for tab
  4333.                                    characters written to windows. Default
  4334.                                    value: 8.
  4335.  
  4336.  
  4337.  
  4338.  
  4339.  
  4340.  
  4341.  
  4342.  
  4343.  
  4344.  
  4345.  
  4346.  
  4347.  
  4348.  
  4349.  
  4350.  
  4351.  
  4352.  
  4353.  
  4354.  
  4355.  
  4356.  
  4357.  
  4358.  
  4359.  
  4360.  
  4361.  
  4362.  
  4363.  
  4364.  
  4365.  
  4366.  
  4367.  
  4368.  
  4369.                                          72
  4370.