• Main Page
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

dg300.c

Go to the documentation of this file.
00001 // $Id: dg300.c 11282 2010-10-28 16:26:09Z airwin $
00002 //
00003 //      PLplot dg300 device driver.
00004 //
00005 #include "plDevs.h"
00006 
00007 #ifdef PLD_dg300
00008 
00009 #include "plplotP.h"
00010 #include "drivers.h"
00011 
00012 // Device info
00013 PLDLLIMPEXP_DRIVER const char* plD_DEVICE_INFO_dg300 = "dg300:DG300 Terminal:0:dg300:25:dg300\n";
00014 
00015 void plD_dispatch_init_dg( PLDispatchTable *pdt );
00016 
00017 void plD_init_dg( PLStream * );
00018 void plD_line_dg( PLStream *, short, short, short, short );
00019 void plD_polyline_dg( PLStream *, short *, short *, PLINT );
00020 void plD_eop_dg( PLStream * );
00021 void plD_bop_dg( PLStream * );
00022 void plD_tidy_dg( PLStream * );
00023 void plD_state_dg( PLStream *, PLINT );
00024 void plD_esc_dg( PLStream *, PLINT, void * );
00025 
00026 // top level declarations
00027 
00028 #define  DGX    639
00029 #define  DGY    239
00030 
00031 struct termattr
00032 {
00033     unsigned char com[4];
00034     unsigned char rom[4];
00035     unsigned char ram[4];
00036     unsigned char con[5];
00037     unsigned char eor;
00038 } termattr;
00039 
00040 void plD_dispatch_init_dg( PLDispatchTable *pdt )
00041 {
00042 #ifndef ENABLE_DYNDRIVERS
00043     pdt->pl_MenuStr = "DG300 Terminal";
00044     pdt->pl_DevName = "dg300";
00045 #endif
00046     pdt->pl_type     = plDevType_Interactive;
00047     pdt->pl_seq      = 25;
00048     pdt->pl_init     = (plD_init_fp) plD_init_dg;
00049     pdt->pl_line     = (plD_line_fp) plD_line_dg;
00050     pdt->pl_polyline = (plD_polyline_fp) plD_polyline_dg;
00051     pdt->pl_eop      = (plD_eop_fp) plD_eop_dg;
00052     pdt->pl_bop      = (plD_bop_fp) plD_bop_dg;
00053     pdt->pl_tidy     = (plD_tidy_fp) plD_tidy_dg;
00054     pdt->pl_state    = (plD_state_fp) plD_state_dg;
00055     pdt->pl_esc      = (plD_esc_fp) plD_esc_dg;
00056 }
00057 
00058 //--------------------------------------------------------------------------
00059 // plD_init_dg()
00060 //
00061 // Initialize device.
00062 //--------------------------------------------------------------------------
00063 
00064 void
00065 plD_init_dg( PLStream *pls )
00066 {
00067 // Request terminal configuration report
00068 
00069     printf( "\n\036\107\051\n" );
00070     scanf( "%s", (char *) &termattr );
00071     while ( getchar() != '\n' )
00072         ;
00073     if ( !strncmp( (char *) &termattr.ram[0], "0000", 4 ) )
00074     {
00075         printf( "Please wait while graphics interpreter is downloaded.\n" );
00076 
00077         // Need to download graphics interpreter.
00078 
00079         system( "cat  /usr/local/src/g300/g300gci110.tx" );
00080     }
00081 
00082 // Clear screen, Set pen color to green, Absolute positioning
00083 
00084     printf( "\036\107\063\060\n\036\107\155\061\n\036\107\151\060\n" );
00085     printf( "\036\107\042\061\n" );
00086 
00087     pls->termin = 1;            // Is an interactive device
00088 
00089     plP_setpxl( (PLFLT) ( 3.316 * 16 ), (PLFLT) ( 1.655 * 16 ) );
00090     plP_setphy( 0, DGX * 16, 0, DGY * 16 );
00091 }
00092 
00093 //--------------------------------------------------------------------------
00094 // plD_line_dg()
00095 //
00096 // Draw a line in the current color from (x1,y1) to (x2,y2).
00097 //--------------------------------------------------------------------------
00098 
00099 void
00100 plD_line_dg( PLStream *pls, short x1a, short y1a, short x2a, short y2a )
00101 {
00102     int x1 = x1a, y1 = y1a, x2 = x2a, y2 = y2a;
00103 
00104     printf( "LINE %d %d %d %d\n", x1 >> 4, y1 >> 3, x2 >> 4, y2 >> 3 );
00105 }
00106 
00107 //--------------------------------------------------------------------------
00108 // plD_polyline_dg()
00109 //
00110 // Draw a polyline in the current color.
00111 //--------------------------------------------------------------------------
00112 
00113 void
00114 plD_polyline_dg( PLStream *pls, short *xa, short *ya, PLINT npts )
00115 {
00116     PLINT i;
00117 
00118     for ( i = 0; i < npts - 1; i++ )
00119         plD_line_dg( pls, xa[i], ya[i], xa[i + 1], ya[i + 1] );
00120 }
00121 
00122 //--------------------------------------------------------------------------
00123 // plD_eop_dg()
00124 //
00125 // End of page.  User must hit a <CR> to continue.
00126 //--------------------------------------------------------------------------
00127 
00128 void
00129 plD_eop_dg( PLStream *pls )
00130 {
00131     putchar( '\007' );
00132     fflush( stdout );
00133     while ( getchar() != '\n' )
00134         ;
00135     printf( "ERASE\n" );
00136 }
00137 
00138 //--------------------------------------------------------------------------
00139 // plD_bop_dg()
00140 //
00141 // Set up for the next page.
00142 //--------------------------------------------------------------------------
00143 
00144 void
00145 plD_bop_dg( PLStream *pls )
00146 {
00147     pls->page++;
00148 }
00149 
00150 //--------------------------------------------------------------------------
00151 // plD_tidy_dg()
00152 //
00153 // Close graphics file
00154 //--------------------------------------------------------------------------
00155 
00156 void
00157 plD_tidy_dg( PLStream *pls )
00158 {
00159     printf( "\036\107\042\060\n" );
00160     fflush( stdout );
00161 }
00162 
00163 //--------------------------------------------------------------------------
00164 // plD_state_dg()
00165 //
00166 // Handle change in PLStream state (color, pen width, fill attribute, etc).
00167 //--------------------------------------------------------------------------
00168 
00169 void
00170 plD_state_dg( PLStream *pls, PLINT op )
00171 {
00172 }
00173 
00174 //--------------------------------------------------------------------------
00175 // plD_esc_dg()
00176 //
00177 // Escape function.
00178 //--------------------------------------------------------------------------
00179 
00180 void
00181 plD_esc_dg( PLStream *pls, PLINT op, void *ptr )
00182 {
00183 }
00184 
00185 #else
00186 int
00187 pldummy_dg300()
00188 {
00189     return 0;
00190 }
00191 
00192 #endif                          // PLD_dg300

Generated on Wed Oct 12 2011 20:42:21 for PLplot by  doxygen 1.7.1