home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / GRAPHICS / SHOWGL10.ZIP / SHOWHPGL.DOC < prev    next >
Encoding:
Text File  |  1991-09-03  |  14.8 KB  |  405 lines

  1. SHOWHPGL    A viewing program for HP-GL and HP-GL/2 plotting programs.
  2.  
  3.  
  4.  
  5. Introduction
  6.  
  7. This program is designed to preview HP-GL and HP-GL/2 plotting programs
  8. on the console screen of an IBM PC or compatible computer.  It
  9. impliments 45 of 97 HP-GL or HP-GL/2 instruction.  Of the 97
  10. instruction, 22 either have no meaning for this type of program or
  11. are otherwise unrelated to drawing.
  12.  
  13. It is written in Microsoft C, version 6.0.  It requires MS-DOS
  14. version 3.0 or above to run.  This program is meant to be used as a
  15. preview tools for HP-GL files.  It is as accurate as it could be made
  16. with the limited information and resources available at the time it
  17. was written.  Known bugs or deficiencies are listed after the
  18. instruction set summary.
  19.  
  20.  
  21.  
  22. Usage
  23.  
  24. SHOWHPGL -[video][paper][plotter]  [filename]
  25.  
  26. where 
  27.  
  28.     filename    optional filename for HP-GL source file.  If a 
  29.             filename is not supplied, standard input is 
  30.             assumed.
  31.  
  32.     video        option to force usage of a particular video 
  33.             mode.  Values are: c, e, v, for CGA, EGA, or 
  34.             VGA.
  35.               'c' will force CGA 640 x 200 monochrome mode,
  36.               'e' will force EGA 640 x 350 16 color mode,
  37.               'v' will force VGA 640 x 480 16 color mode.
  38.  
  39.             Default mode is autodetect and select 
  40.             highest resolutions standard mode available.  
  41.             No SVGA modes are supported.
  42.  
  43.     paper        One of the following standard paper sizes:
  44.             A, B, C, D, E, or A4, A3, A2, A1, A0 .  
  45.             Default size is A. Case is important!!
  46.             A0 is a paper size option: a0 is unknown.
  47.  
  48.     plotter        Default emulation is HP 7470/7475 plotter.
  49.             'dp'  will select DraftPro emulation.
  50.  
  51.             The HP 7470/7475 have the plotter units coordinate
  52.             origin in the lower left corner.  The DraftPro
  53.             uses the center of the page as the origin.
  54.  
  55.  
  56. The user may also set the environment variable HP-GL to a default set 
  57. of switches, i.e.,
  58.  
  59. set hpgl=dpA3
  60.  
  61. specifies default options of DraftPro mode and A3 size paper.
  62.  
  63. If command line switches are present, the environment settings are
  64. ignored.  Multiple paper size selections will cause the program to
  65. abort.  Multiple video mode selections will default to the highest
  66. resolution autodetected mode.
  67.  
  68. The switch character is defined as '-'.   It is hard coded into the 
  69. program.  Directory path names may include either or both '\' and '/'
  70. directory separators.  This program has been tested under MS-DOS 3.20
  71. and MS-DOS 5.0 .
  72.  
  73. All video graphics functions draw using the video BIOS.  No direct 
  74. screen I/O is used.  Additional BIOS supported graphics modes may be 
  75. supported by defining the appropriate structures in graphix.h and the 
  76. macros in graph.h and making appropriate changes to the mode lists in 
  77. autogrph.c and showhpgl.c .
  78.  
  79. NOTE:  This program generates diagnostic output text strings when 
  80. illegal or unsupported instructions are encountered.  THESE STRINGS 
  81. APPEAR IN THE GRAPHICS DISPLAY AND MAY INTERFERE WITH THE DRAWING IF 
  82. SUFFICIENT ERRORS OCCUR.  If you expect large numbers of errors, wish
  83. to retain a listing of the output, or can not tolerate this text in 
  84. the display, redirect any generated output to a file.
  85.  
  86. Note also that this program DOES NOT restore the video mode which was 
  87. in use prior to calling this program.  Although the EGA and VGA 
  88. display systems are capable of better than 80 columns and 25 rows on 
  89. the screen, they do not appear as supported IBM BIOS video modes.  
  90. Determination of nonstandard video mode parameters was beyond the 
  91. scope of this program.  If you want to restore a recognized video mode 
  92. at the end of program execution, add the following code to showhpgl.c just 
  93. before the end of main ():
  94.  
  95.     twait (infile, 50);
  96.     graphics_off ();
  97.  
  98. This will introduce a 50 second delay before restoring the video mode.  
  99. If the video mode was not a BIOS standard video mode, graphics_off () 
  100. may not be able to restore it properly.
  101.  
  102.  
  103. Compilation
  104.  
  105. The entire package is compiled as follows:
  106.  
  107. cl [-qc] showhpgl.c hpgl1.c hpgl2.c getargs.c autogrph.c graphix.lib
  108.  
  109. Because graphix.lib internally uses Microsoft interrupt calling 
  110. functions, it is unlikely that this can be ported to Borland C without 
  111. re-writing the interrupt calls in graphix.lib
  112.  
  113.  
  114. Distribution Package
  115.  
  116. The distribution package includes the following:
  117.  
  118. showhpgl.doc        this document
  119. showhpgl.exe        the executable program file
  120. showhpgl.c        main program
  121. hpgl1.c            additional functions
  122. hpgl2.c            additional functions
  123. hpgl.h            header file for showhpgl.c, hpgl1.c hpgl2.c
  124. getargs.c        command line options and arguments
  125. autogrph.c        video graphix adapter detection
  126. labels.c        labeling font for showhpgl (part of graphix.lib)
  127. graphix.lib        graphics functions library
  128. graphix.h        header file for main program (showhpgl.c)
  129. graph.h            header file for additional modules (hpgl1.c, 
  130.             hpgl2.c)
  131.  
  132.     HP-GL test programs
  133.  
  134. attest.dpf        AT: 3-point arc, absolute
  135. cptest.dpf        CP: character plot 
  136. dvtest.dpf        DV: variable text path (fails this test)
  137. dvtest1.dpf        DV: variable text path
  138. ea_ertst.dpf        EA, ER: edge rectangle absolute and relative
  139. estest.dpf        ES: extra inter-character spacing
  140. ewtest.dpf        EW: outline wedge
  141. iwtest.dpf        IW: soft-clip window
  142. label4.dpf        LB, LO: labels and label origins
  143. prtest.dpf        PR: relative plotting
  144. ratest.dpf        RA: filled rectangle, absolute (outline, only: no fill)
  145. rrtest.dpf        RR: filled rectangle, relative (outline, only: no fill)
  146. rttest.dpf        RT: 3-point arc, relative
  147. sltest.dpf        SL: character slant
  148. smtest.dpf        SM: symbol mode
  149. srtest.dpf        SR: relative text size
  150. test1.dpf        AR,IP,SC,PR: non-specific test program
  151. test2.dpf        IP,SL,AA,CI: non-specific test program
  152. test3.dpf        LB,LO,TL,XT,YT: test labels, label origins, x-,
  153.                 & y-ticks
  154. fwdaltbx.dpf        drawing to demonstrate the -dp drawing option.  
  155.                 Use -C or larger for paper size.
  156.  
  157. Most of these test programs are taken from "The HP-GL/2 Reference Guide" 
  158. and, as such are copyright 1990 by Hewlett-Packard.  There are 
  159. illustrations of what the output of most of these programs should look 
  160. like accompanying the description of the instruction .
  161.  
  162. The file labels.c is included for those who wish to modify the font used
  163. for labeling.  This font is incorporated into graphix.lib.  To modify the
  164. font, make the required changes to labels.c, compile it to a ".obj" file,
  165. and update the library using "LIB -+labels;" (Microsoft library manager).
  166. You may then re-link the remaining files to create a new program which
  167. uses the new fonts.
  168.  
  169.  
  170. Licensing
  171.  
  172. 1.    This program and the component files are supplied on an as-is 
  173.     basis.  They have been thoroughly tested, but may still contain 
  174.     unknown bugs.
  175.  
  176. 2.    The source code and object code is copyright 1991 or as
  177.     otherwise noted by Robert C. Becker.
  178.  
  179. 3.    The executable program may be used for any purpose except
  180.     commercial resale.  It is otherwise not restricted in any way.
  181.     Licenses for commercial resale may be obtained from the author.
  182.     
  183. 4.    The source code may be modified for personal use.  Modified 
  184.     source code must retain the original copyright notice and may
  185.     not be re-distributed.  Modifications may be included in the
  186.     form of "difference files" which are included as additional
  187.     files to this distribution.
  188.  
  189. 5.    Portions of the source code may be extracted for use in other 
  190.     programs provided the copyright notice remains in the source code,
  191.     and those programs do not materially replicate the function of the
  192.     program for which this code was generated (that is, you may not 
  193.     use this source code as a basis for a commercial HP-GL or HP-GL/2
  194.     file viewer).
  195.  
  196. 6.    Works which contain portions of the source code provided herein 
  197.     may be freely distributed.  No license is required for such
  198.     distributions, but the original copyright notice must be retained
  199.     within the salient portions of the code.
  200.  
  201. 7.    This package may be re-distributed for a fee covering the
  202.     reproduction costs.  The files listed under Distribution 
  203.     Package must be distributed without modification and the 
  204.     complete set of files listed must be included.
  205.  
  206. 8.    The usage of the word "portions" indicates 1) less than 50% of the
  207.     source code supplied herein; 2) that the content of a program which
  208.     is the beneficiary of this source code may not be composed of more
  209.     than 35% of source code taken from this distribution.
  210.  
  211. Author's Note:  In case anyone thinks this is a particularly onerous set of
  212. conditions to follow, 1) remember, this is a free program for you to use;
  213. 2) remember the affair of the "Foley Extra DOS" utilities in which all 
  214. manner of accusations were made regarding ownership, authorship, and 
  215. plagerism; 3) if you really want to use this as a basis for a commercial 
  216. tool, contact me.
  217.  
  218.  
  219. Bug Reports:
  220.  
  221. Please report any bugs to 
  222.  
  223. becker@src.honeywell.com   (Robert Becker).  
  224.  
  225. If you prefer, mail them to me at
  226.  
  227. Robert Becker
  228. 15836 Quebec Circle
  229. Eden Prairie, MN   55346
  230.  
  231.  
  232. Instructions Status
  233.  
  234. The following is a list of instructions and the level of implimentation
  235. in showhpgl.exe of HP-GL/2 instructions.  Note that not all instructions 
  236. are HP-GL/2 instructions.  Those with notations in the source column 
  237. indicate where this instruction was found.  Status indicates the level of 
  238. implimentation of the instruction.  There are four levels of implimentation:
  239.  
  240. Full:        instruction is fully functional as per HP-GL/2
  241. Partial:    instruction implimentation is incomplete
  242. NOP:        no action or action not meaningful for this application
  243. N/A:        not available: instruction was not implimented.
  244.  
  245. There are 36 Full, 9 partial, 22 NOP, and 30 N/A instructions.  Of the
  246. N/A instructions,  11 are related to character set or font selection.  Of 
  247. the NOP instructions, 12 are related to output or digitizing a point.
  248. All output instruction that have no meaning in this application and
  249. are implimented as NOP instructions.  No dual context mode
  250. instructions (HP-GL & PCL) have been inplimented.
  251.  
  252. Command    Description            Status    source        Comments
  253.  
  254. AA    arc absolute            Full
  255. AC    anchor corner            Full
  256. AD    alternate font definition    N/A
  257. AR    arc relative            Full
  258. AT    3 point arc absolute        Full
  259. BP    begin plot            Partial            waits TWAIT seconds before clearing plot from screen
  260. CA    designate alternate char. set    N/A    7470
  261. CF    char. fill mode            N/A
  262. CI    circle                Full
  263. CP    character plot            Full
  264. CS    designate std. character set    N/A
  265. CR    color range            N/A
  266. CT    chord tolerance            Full
  267. DC    digitizer clear            NOP
  268. DF    default                Full
  269. DI    absolute label direction    Full
  270. DL    download character        N/A
  271. DP    digitize point            NOP
  272. DR    relative label direction    Full
  273. DS    designate char. set into slot    N/A    DraftPro
  274. DT    Define label terminator        Full
  275. DV    Define variable text path    Partial            No line feed reversal
  276. EA    edge rectangle absolute        Full
  277. EC    enable cutter            NOP
  278. EP    edge polygon            N/A
  279. ER    edge rectangle relative        Full
  280. ES    extra space            Full
  281. ESC    escape code instructions    Partial            No PCL mode switch commands
  282. EW    edge wedge            Full
  283. FI    primary font selection by ID    N/A
  284. FN    secondary font selection by ID    N/A
  285. FP    fill polygon            N/A
  286. FR    frame advance            N/A
  287. FT    fill type            Partial            Only hatched and cross-hatched fills
  288. GM    graphics memory            NOP    DraftPro
  289. IM    input mask            NOP    7470
  290. IN    initialize            Full            Since there is no 'front panel', IN1 is same as IN
  291. IP    input P1 & P2            Full
  292. IR    input relative P1 & P2        Full
  293. IW    input window            Full
  294. LA    line attributes            NOP            No wide lines available
  295. LB    label                Full
  296. LO    label origin            Full
  297. LT    line type            Partial            No adaptive line patterns
  298. MC    merge control            N/A
  299. MG    message to panel        NOP
  300. MT    media type            NOP
  301. NP    number of pens            NOP
  302. NR    not ready            Full
  303. OA    output pen position & status    NOP    7470
  304. OC    output commanded positon & sts    NOP    7470
  305. OD    output digitized point & sts    NOP
  306. OE    output error            NOP
  307. OH    output hard-clip limits        NOP
  308. OI    output identification        NOP
  309. OO    output options            NOP    7470
  310. OP    output P1 & P2            NOP
  311. OS    output status            NOP
  312. OW    output window            NOP    7470
  313. PA    plot absolute            Full
  314. PC    assign pen colors        N/A
  315. PD    pen down            Full
  316. PE    polyline encoded        N/A
  317. PG    page advance            Modified    Waits 6 seconds before clearing screen
  318. PM    polygon mode            N/A
  319. PR    plot relative            Full
  320. PS    plot size            Full
  321. PU    pen up                Full
  322. PW    pen width            N/A
  323. QL    quality level            NOP
  324. RA    fill rectangle absolute        Partial        only hatch & cross-hatch fills
  325. RF    raster fill definition        N/A
  326. RO    rotate coordinate system    N/A
  327. RP    replot                N/A
  328. RR    fill rectangle relative        Partial        only hatch & cross-hatch fills
  329. RT    relative arc 3-point        Full
  330. SA    select alternate font        N/A
  331. SB    scalable or bitmap font        N/A
  332. SC    scale plot            Partial        left & bottom parameters for isotropic scaling not implimented
  333. SD    standard font definition    N/A
  334. SI    absolute char. size        Full
  335. SL    char. slant            Full
  336. SM    symbol mode            Full
  337. SP    select pen            Full
  338. SR    relative char. size        Full
  339. SS    select standard char. set    N/A
  340. ST    sort vectors            NOP
  341. SV    screened vectors        N/A
  342. TL    tick length            Full    7470
  343. TD    transparent data        N/A
  344. TR    transparency mode        N/A
  345. UC    user defined character        N/A
  346. UL    user defined line pattern    N/A
  347. VS    velocity select            NOP
  348. WG    fill wedge            Partial        Outline of wedge, only (no filling available)
  349. WU    pen width unit selection    N/A
  350. XT    x-tick                Full    7470
  351. YT    y-tick                Full    7470
  352.  
  353. Notes:
  354.  
  355.     BP instruction is checked for syntax.  BP will wait PG_DELAY seconds
  356.     before clearing the screen if the screen was plotted on.  If the
  357.     screen was not plotted on, the plotter is initialized.  In either
  358.     case, the plotter is initialized.
  359.  
  360.     PG instruction generates a wait of PG_DELAY seconds before clearing 
  361.     the screen.
  362.  
  363.     PG_DELAY is defined in hpgl.h as 6 seconds.
  364.  
  365.     HP-GL and HP-GL/2 distinguish between <cr> and <lf> for 
  366.     positioning on labels.  The C-language, being based in UNIX, 
  367.     assumes the <lf> is the newline character and <cr> has no 
  368.     meaning.  This assumption is also present in this program and 
  369.     some test case labeling and character plotting tests will fail 
  370.     because of this.  The test program dvtest.dpf fails because of 
  371.     this.  The display should look something like:
  372.  
  373.           D A                  ABC
  374.           E B                  DEF
  375.           F C                     GHI
  376.         G
  377.         H
  378.         I
  379.  
  380.     Several of the HP-GL/2 specifications are incomplete.  For 
  381.     example, when one is drawing a wedge with symbol mode on, 
  382.     placement of the symbol is unspecified.  Similarly, when TD 
  383.     (transparent data) mode is on, the font used to display the 
  384.     control characters is not specified.  Error handling is not 
  385.     always specified.
  386.  
  387.     For hatch and cross-hatch fills, it is not clearly specified 
  388.     for the case of user-unit defined hatch x-spacing if the scale 
  389.     in the y-direction should affect the spacing of the hatch. In this 
  390.     implimentation, it was decided that the hatch spacing displayed on
  391.     the screen should be invariant with the rotation angle.
  392.  
  393.     HP-GL, HP-GL/2, HP, Hewlett-Packard, and DraftPro are registered
  394.     trademarks of the Hewlett-Packard company.
  395.  
  396.     PC, CGA, EGA, VGA are or may be registered trademarks of the IBM
  397.     company.
  398.  
  399.     UNIX is a trademark of AT&T.
  400.  
  401. Reference:
  402.  
  403.     "The HP-GL/2 Reference Guide", Addison-Wesley Publishing Company.
  404.  
  405.