/* @(#)copygrap.c 17.1.1.1 (ESO-DMD) 01/25/02 17:45:01 */ /*=========================================================================== Copyright (C) 1995 European Southern Observatory (ESO) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. Correspondence concerning ESO-MIDAS should be addressed as follows: Internet e-mail: midas@eso.org Postal address: European Southern Observatory Data Management Division Karl-Schwarzschild-Strasse 2 D 85748 Garching bei Muenchen GERMANY ===========================================================================*/ /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ .COPYRIGHT (c) 1993 European Southern Observatory .IDENTIFIER SENDPLOT .AUTHOR R.M. van Hees IPG-ESO Garching .KEYWORDS Graphics, printing .LANGUAGE C .PURPOSE Redraw a plotfile and sends it to a device input: P1/C/1/20: plotting device P2/C/1/60: plot file .COMMENTS none .ENVIRONment MIDAS and AGL #include Prototypes for MIDAS interfaces #include General symbols for Plot routines #include Symbols used by the OS interfaces .VERSION 1.1 13-Sep-1993 FORTRAN --> ANSI-C RvH 010423 last modif ------------------------------------------------------------*/ /* * Define _POSIX_SOURCE to indicate * that this is a POSIX program */ #define _POSIX_SOURCE 1 /* * definition of the used functions in this module */ #include #include #include #include /* * define some macros and constants */ #include #include /* * here start the code of the function */ int main() { int actvals, fid; char debug[5], device[21], dname[21], plnam[61]; char *err_gdev = "*** FATAL: Error detected in GETDEV", *err_dev = "*** FATAL: Unknown or unavailable device", *err_hlp = " use HELP [printers]", *err_plnm = "*** FATAL: No plot file present; sorry ...", *err_plex = "*** FATAL: Plot file not present; does it really exist?"; /* * start of executable code */ (void) SCSPRO( "CPYGRP" ); /*contact with the MIDAS monitor*/ (void) SCKGETC( "P1", 1, 20, &actvals, device ); CGN_LOWSTR( device ); if ( GETDEV( device, dname ) != ERR_NORMAL ) SCETER( 1, err_gdev ); /* * setup viewport */ CGN_LOWSTR( dname ); if ( strncmp( dname, "unknown", 7 ) == 0 ) { SCTPUT( err_dev ); SCETER( 2, err_hlp ); } /* * get the plot file to be send */ (void) SCKGETC( "P2", 1, 60, &actvals, plnam ); /* CGN_LOWSTR( plnam ); */ if ( strncmp( plnam, "undef", 5 ) == 0 ) { PCKRDC( "PLNAM", 60, &actvals, plnam ); /* CGN_LOWSTR( plnam ); */ if ( strncmp( plnam, "none", 4 ) == 0 ) SCETER( 3, err_plnm ); if ( (fid = osdopen( plnam, READ )) == -1 ) SCETER( 4, err_plex ); } else if ( (fid = osdopen( plnam, READ )) == -1 ) SCETER( 5, err_plex ); /* * set the error recording */ PCKRDC( "DEBUG", 4, &actvals, debug ); if ( strncmp( debug, "ON", 2 ) == 0 ) AG_SSET( "msgw;debu=1;errf=aglerr.log" ); else AG_SSET( "msgn;debu=0" ); /* * open viewport */ (void) AG_VDEF( dname, 0.0, 1.0, 0.0, 1.0, 0.0, 0.0 ); AG_MRDW( plnam ); (void) osdclose(fid); AG_CLS(); return SCSEPI(); }