~ubuntu-branches/debian/jessie/eso-midas/jessie

« back to all changes in this revision

Viewing changes to prim/plot/libsrc/pliden.c

  • Committer: Package Import Robot
  • Author(s): Ole Streicher
  • Date: 2014-04-22 14:44:58 UTC
  • Revision ID: package-import@ubuntu.com-20140422144458-okiwi1assxkkiz39
Tags: upstream-13.09pl1.2+dfsg
ImportĀ upstreamĀ versionĀ 13.09pl1.2+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*===========================================================================
 
2
  Copyright (C) 1993-2009 European Southern Observatory (ESO)
 
3
 
 
4
  This program is free software; you can redistribute it and/or 
 
5
  modify it under the terms of the GNU General Public License as 
 
6
  published by the Free Software Foundation; either version 2 of 
 
7
  the License, or (at your option) any later version.
 
8
 
 
9
  This program is distributed in the hope that it will be useful,
 
10
  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
  GNU General Public License for more details.
 
13
 
 
14
  You should have received a copy of the GNU General Public 
 
15
  License along with this program; if not, write to the Free 
 
16
  Software Foundation, Inc., 675 Massachusetss Ave, Cambridge, 
 
17
  MA 02139, USA.
 
18
 
 
19
  Corresponding concerning ESO-MIDAS should be addressed as follows:
 
20
        Internet e-mail: midas@eso.org
 
21
        Postal address: European Southern Observatory
 
22
                        Data Management Division 
 
23
                        Karl-Schwarzschild-Strasse 2
 
24
                        D 85748 Garching bei Muenchen 
 
25
                        GERMANY
 
26
===========================================================================*/
 
27
 
 
28
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
29
.IDENTifer   PLIDEN
 
30
.AUTHOR      R.M. van Hees IPG-ESO Garching
 
31
.KEYWORDS    plot software, additional information
 
32
.PURPOSE     plot minimal information around a graph, outside the axis
 
33
     input:   int   plmode    plot mode, see PMODE in PLISTAT
 
34
              char  *lstrng   string plotted above graph in left corner
 
35
              char  *rstrng   string plotted above graph in right corner
 
36
 
 
37
.COMMENTS    this routine only works when PMODE == 1
 
38
.ENVIRONment MIDAS and AGL
 
39
             #include <agl.h>           Prototypes for AGL application programs
 
40
             #include <midas_def.h>     Prototypes for MIDAS interfaces
 
41
 
 
42
.VERSION     1.0     26-Sep-1993   FORTRAN --> ANSI-C    RvH
 
43
 
 
44
090422          last modif
 
45
------------------------------------------------------------*/
 
46
/*
 
47
 * Define _POSIX_SOURCE to indicate
 
48
 * that this is a POSIX program
 
49
 */
 
50
#define  _POSIX_SOURCE 1
 
51
 
 
52
/*
 
53
 * definition of the used functions
 
54
 */
 
55
#include <stdio.h>
 
56
#include <stdlib.h>
 
57
#include <string.h>
 
58
 
 
59
#include <midas_def.h>
 
60
 
 
61
/*
 
62
 * define some macros and constants
 
63
 */
 
64
#define  NCTIME         5               /* we write hh:mm in variable TIM */
 
65
 
 
66
/*
 
67
 * here start the code
 
68
 */
 
69
void PLIDEN( plmode, lstrng, rstrng )
 
70
int  plmode;
 
71
char *lstrng, *rstrng;
 
72
 
 
73
{
 
74
int   actvals;
 
75
float scale, tsize, xl[3], yl[3], clpl[4];
 
76
char  tim[6], dattim[41], buff[81], text[81];
 
77
 
 
78
/* 
 
79
 * check if PMODE is one, else retrun
 
80
 */
 
81
if ( plmode != 1 ) return;
 
82
 
 
83
/*
 
84
 * get character dimension, from the MIDAS keywords
 
85
 * and scaling from AGL
 
86
 */
 
87
(void) AG_RGET( "scale", &scale );
 
88
PCKRDR( "TSIZE", 1, &actvals, &tsize );
 
89
AG_TGET( "M", xl, yl );
 
90
 
 
91
AG_SSET( "lfrg" );
 
92
AG_SSET( "norm" );
 
93
AG_SSET( "linx");
 
94
AG_SSET( "liny");
 
95
(void) AG_RGET( "clpl", clpl );
 
96
 
 
97
/*
 
98
 * write both strings
 
99
 */
 
100
(void) strcpy( text, "~^" );
 
101
(void) strcat( text, lstrng );
 
102
LABSTR( text );
 
103
AG_GTXT( clpl[0], clpl[3] + yl[2], text, 1 );
 
104
 
 
105
(void) strcpy( text, "~^" );
 
106
(void) strcat( text, rstrng );
 
107
LABSTR( text );
 
108
AG_GTXT( clpl[1], clpl[3] + yl[2], text, 3 );
 
109
 
 
110
/*
 
111
 * set character height and write from up to down (instead of left to right)
 
112
 */
 
113
AG_SSET( "scale=1.0;chdi=1.0,1.0" );
 
114
AG_SSET( "updo" );
 
115
 
 
116
/*
 
117
 * which MIDAS version is used ?
 
118
 */
 
119
(void) SCKGETC( "MID$SESS", 16, 5, &actvals, buff );
 
120
(void) strcpy( text, "~-~-eso-midas version: " );
 
121
(void) strcat( text, buff );
 
122
 
 
123
/*
 
124
 * get the date
 
125
 */
 
126
(void) SCKGETC( "DATTIM", 1, 40, &actvals, dattim );
 
127
(void) strcat( text, "    date: " );
 
128
 
 
129
*tim = '\0';
 
130
if ( strchr( dattim, ',' ) == 0 )
 
131
   { *(dattim+20) = '\0';
 
132
     (void) strncpy( tim, dattim+12, NCTIME );
 
133
     *(dattim+11)='\0';
 
134
     (void) strcat( text, dattim );
 
135
   }                
 
136
else
 
137
   { *(dattim+26) = '\0';
 
138
     (void) strncpy( tim, dattim+18, NCTIME );
 
139
     *(dattim+15)='\0';
 
140
     (void) strcat( text, dattim );
 
141
   }
 
142
(void) strcat( text, " " );
 
143
(void) strncat( text, tim, NCTIME );
 
144
AG_GTXT( 1.0, 1.0, text, 23 );
 
145
 
 
146
/*
 
147
 * get the username, and write it
 
148
 */
 
149
PLUSER( buff );
 
150
(void) strcat( strcpy( text, "~-~-" ), buff );
 
151
AG_GTXT( 1.0, 0.0, text, 17 );
 
152
 
 
153
/*
 
154
 * reset if necessary the symbol and text size
 
155
 */
 
156
AG_SSET( "lfrg" );
 
157
(void) sprintf( text, "scale=%-.3f;chdi=%-.3f,%-.3f", scale, tsize, tsize );
 
158
AG_SSET( text );
 
159
}
 
160
 
 
161