7-114 Chapter7
Programming Examples
Report Generation Examples
570 DIM Hpglinit$[80] ! Printer HPGL initialization string
580 DIM Srch$[60] ! Search string for plot filenames
590 DIM Esc_chr$[1] ! Escape character ASCII 27
600 INTEGER Plt_arry1(1:32767) ! Plotter command array
610 INTEGER Plt_arry2(1:2,1:32767) ! Additional plot arrays if required
620 INTEGER Plttr ! Plotter for output
630 INTEGER Prntr ! Printer for output
640 INTEGER Outputdvc ! Output device selected
650 INTEGER Root_mtch ! Root plot file flag
660 INTEGER Flnm_idx ! Pointer to filename array
670 INTEGER Nbr_files ! Number of files which are plot files
680 INTEGER Prfx_lngth ! Length of prefix defined in filename
690 INTEGER Root_lngth ! Length of root name in file name
700 INTEGER Arry1_sz ! Number of data works in plot file
710 INTEGER Arry2_sz ! Number of arrays in plot file
720 INTEGER Plttr_addr ! Plotter address
730 INTEGER Prntr_addr ! Printer address
740 REAL Rcrd_lngth ! Record length in plot file
750 REAL Nmbr_rcrds ! Number of records in plot file
760 REAL Nmbr_wrds ! Number of data words in plot file
770 !
780 Esc_chr$=CHR$(27) ! Escape character (1B hex) ASCII 27 (Decimal)
790 !
800 ! *** Build control string for printers ***
810 !
820 ! Build hardcopy device control string containing setup commands for
830 ! printer output.
840 ! Reset, conditional page eject
850 Hpglinit$=Esc_chr$&”E”
860 ! Page size A 8.5 x 11
870 Hpglinit$=Hpglinit$&Esc_chr$&”&12A”
880 ! Landscape orientation
890 Hpglinit$=Hpglinit$&Esc_chr$&”&l1O”
900 ! No left margin
910 Hpglinit$=Hpglinit$&Esc_chr$&”&a0L”
920 ! No right margin
930 Hpglinit$=Hpglinit$&Esc_chr$&”&a400M”
940 ! No top margin
950 Hpglinit$=Hpglinit$&Esc_chr$&”&l0E”
960 ! Picture frame size 10.66 inches x 7.847 inches
970 ! (720 decipoints per inch)
980 Hpglinit$=Hpglinit$&Esc_chr$&”*c7680x5650Y”
990 ! Move cursor to anchor point
1000 Hpglinit$=Hpglinit$&Esc_chr$&”*p50x50Y”
1010 ! Set picture frame anchor point
1020 Hpglinit$=Hpglinit$&Esc_chr$&”*c0T”
1030 ! Set CMY palette
1040 Hpglinit$=Hpglinit$&Esc_chr$&”*r-3U”
1050 ! Enter HPGL mode with the cursor (pen) at the PCL current save position
1060 !
1070 ! Exit HPGL mode to accept printer command
1080 Hpgl_exit$=Esc_chr$&”%0A”
1090 !
1100 ! Conditional form feed (page eject)
1110 Form_feed$=Esc_chr$&”E”
1120 !
1130 ! *** Initialize varibles and assign output device ***
1140 !