1
/*===========================================================================
2
Copyright (C) 1995-2009 European Southern Observatory (ESO)
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.
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.
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 Massachusetts Ave, Cambridge,
19
Correspondence 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
26
===========================================================================*/
29
* HEADER : fintf.fc - Vers 3.6.001 - Sep 1993 - L. Fini, M. Pucillo
30
* - Vers 3.6.000 - Oct 1991 - L. Fini, M. Pucillo
33
* AGL FORTRAN to C interface -- Generic version to be filtered
34
* in order to generate the machine
38
* This module is a C layer needed to interface the AGL FORTRAN interface
39
* Layer to the AGL standard C interface
41
* Entry points correspond one-to-one to standard C interface (except for
42
* AGIDN routine which is directly implemented in FORTRAN in file agidn.for
44
* The two routines: AG_SCAN, AG_DMSG are available in the C interface only
46
* Modified: 910617. CG: Master Fortran to C file.
47
* Modified: 910825. CG: This code only compiled for Unix systems.
48
* Modified: 920115. CG: For both VMS and UNIX.
52
* ===============================
53
* AGL FORTRAN STANDARD INTERFACE
59
* The following entry points define the AGL standard FORTRAN interface
62
* I - Status operations
66
* AGCDEF ( XCLIP0, XCLIP1, YCLIP0, YCLIP1 )
70
* AGVDEF ( DEVICE, IDENT, XA, XB, YA, YB, XLIM, YLIM )
76
* AGWDEF ( X0, X1, Y0, Y1 )
79
* II - Graphic primitives
85
* AGGPLM ( X, Y, N, MARK )
89
* AGGTXT ( XT, YT, STRING, CENTRE )
94
* III - Get information
96
* AGIGET (STRING,IVECT)
98
* AGRGET (STRING,RVECT)
100
* AGTGET ( STRING, XL, YL )
102
* AGVLOC ( X, Y, CHAR, PIXVAL )
104
* AGVLOS ( X, Y, MAXLEN, STR, PIXVAL )
107
* IV - Metafile manipulation
122
* AGESC ( CMD, CMDLEN )
128
* AGMAGN ( XFACT, YFACT, X, Y, N )
132
* AGTSET ( XFACT, YFACT, ANGLE, ITEM )
134
* AGVN2U ( XN, YN, XV, YV )
136
* AGVU2N ( XU, YU, XN, YN )
140
* VI - High level routines
142
* AGAXES ( X0, X1, Y0, Y1, CMDSTR )
144
* AGAXIS ( TYPE, DATA, LSPACE, FORM, LABEL )
146
* AGORAX ( TYPE, ENDS, DATA, FORM, LABEL )
148
* AGHIST ( X, Y, N, MODE, JOIN )
150
* AGNLIN ( X0, X1, Y0, Y1, CMDSTR )
156
#include <proto_agl.h>
162
#define MIN(x,y) ((x) <= (y) ? (x):(y) ) /* Minimum */
167
extern char *loc_pntr(int jdx,int* loclen);
168
extern char *strp_pntr(int jdx);
174
/* I - Status operations */
176
ROUTINE AGCDEF (x1,x2,y1,y2)
183
AG_CDEF ( *x1, *x2, *y1, *y2 );
187
ROUTINE AGCLS () { AG_CLS (); return 0;}
189
/*==========================================================================*/
191
/*** stat = AG_SSET(command) ***/
193
ROUTINE AGL1 (status)
194
int *status; /* dummy argument - not used */
197
ptr1 = strp_pntr(1); /* get stripped string of "command" */
203
/*==========================================================================*/
205
/*** stat = AGVDEF ( device, xa,xb,ya,yb,xlim,ylim) ***/
207
ROUTINE AGL2 ( xa,xb,ya,yb,xlim,ylim)
216
ptr1 = strp_pntr(1); /* get stripped string of "device" */
218
(void) AG_VDEF(ptr1, *xa, *xb, *ya, *yb, *xlim, *ylim);
222
ROUTINE AGVKIL () { AG_VKIL (); return 0;}
232
ROUTINE AGWDEF (x1,x2,y1,y2)
239
AG_WDEF ( *x1, *x2, *y1, *y2 );
243
/* II - Graphic primitives */
245
ROUTINE AGGPLG (xv,yv,np)
251
AG_GPLG ( xv, yv, *np );
255
ROUTINE AGGPLL (xv,yv,np)
261
AG_GPLL ( xv, yv, *np );
265
ROUTINE AGGPLM (xv,yv,np,mark)
272
AG_GPLM ( xv, yv, *np, *mark );
276
ROUTINE AGGINT (xv,yv,np)
282
AG_GINT ( xv, yv, *np );
286
/*==========================================================================*/
288
/*** void AGGTXT (xc,yc,str,cntr) ***/
290
ROUTINE AGL3 (xc,yc,cntr)
296
ptr1 = strp_pntr(1); /* get stripped string of "str" */
298
AG_GTXT ( *xc, *yc, ptr1, *cntr );
302
ROUTINE AGVERS () { AG_VERS (); return 0;}
304
/*==========================================================================*/
306
/*** void AGGERR (code,mesg) ***/
312
ptr1 = strp_pntr(1); /* get stripped string of "mesg" */
314
AG_GERR( *code,ptr1);
319
ROUTINE AGISET (ints,numb)
327
ROUTINE AGRSET (floats,numb)
328
float floats[]; int numb;
331
AG_RSET(numb,floats);
335
/* III - Get information */
338
/*==========================================================================*/
340
/*** int AG_IGET (item,ival) ***/
348
ptr1 = strp_pntr(1); /* get stripped string of "item" */
350
n = AG_IGET ( ptr1, ival );
354
/*==========================================================================*/
356
/*** int AG_RGET (item,fval) ***/
365
ptr1 = strp_pntr(1); /* get stripped string of "item" */
367
n = AG_RGET (ptr1, fval );
372
/*==========================================================================*/
374
/*** void AG_TGET (item,xd,yd) ***/
382
ptr1 = strp_pntr(1); /* get stripped string of "item" */
384
AG_TGET (ptr1, xd, yd );
388
ROUTINE AGVLOC (xv,yv,key,pixval)
395
AG_VLOC ( xv, yv, key, pixval );
400
/*==========================================================================*/
402
/*** void AG_VLOS (xv,yv,maxlen,chstrg,pixval) ***/
404
ROUTINE AGL8 (xv,yv,maxlen,pixval)
414
ptr1 = loc_pntr(1,&mm); /* get location of "chstrg" */
416
AG_VLOS ( xv, yv, (mm-1), ptr1, pixval );
418
nn = (int) strlen(ptr1);
419
if (nn < mm) *(ptr1+mm) = ' ';
423
/* IV - Metafile manipulation */
425
ROUTINE AGMCLS () { AG_MCLS (); return 0;}
428
/*==========================================================================*/
430
/*** void AG_MOPN (fname) ***/
432
ROUTINE AGL9 ( status )
436
ptr1 = strp_pntr(1); /* get stripped string of "fname" */
442
/*==========================================================================*/
444
/*** void AG_MRDW (metafile) ***/
446
ROUTINE AGL10 ( status )
450
ptr1 = strp_pntr(1); /* get stripped string of "metafile" */
456
ROUTINE AGMRES () { AG_MRES (); return 0;}
458
ROUTINE AGMSUS () { AG_MSUS (); return 0;}
460
/* V - Miscellaneus */
463
/*==========================================================================*/
465
/*** void AG_ESC (cmd,cmdlen) ***/
467
ROUTINE AGL11 (cmdlen)
471
ptr1 = strp_pntr(1); /* get stripped string of "cmd" */
473
AG_ESC ( ptr1, *cmdlen );
477
ROUTINE AGDRIV () { AG_DRIV (); return 0;}
479
ROUTINE AGMAGN (xfact,yfact,xv,yv,np)
487
AG_MAGN( *xfact, *yfact, xv, yv, *np );
491
ROUTINE AGTROT (xv,yv,np)
497
AG_TROT ( xv, yv, *np );
501
ROUTINE AGTSET (xoff,yoff,angle,item)
508
AG_TSET ( *xoff, *yoff, *angle, *item );
512
ROUTINE AGVN2U (xn,yn,xu,yu)
519
AG_VN2U ( *xn, *yn, xu, yu );
523
ROUTINE AGVU2N (xu,yu,xn,yn)
530
AG_VU2N ( *xu, *yu, xn, yn );
534
ROUTINE AGVUPD () { AG_VUPD (); return 0;}
536
/* VI - High level routines */
539
/*==========================================================================*/
541
/*** void AG_AXES (x1,x2,y1,y2,string) ***/
543
ROUTINE AGL12 (x1,x2,y1,y2)
550
ptr1 = strp_pntr(1); /* get stripped string of "string" */
552
AG_AXES ( *x1, *x2, *y1, *y2,ptr1);
556
/*==========================================================================*/
558
/*** void AG_AXIS (type, data, lspace, form, label) ***/
560
ROUTINE AGL13 (type, data, lspace)
566
ptr1 = strp_pntr(1); /* get stripped string of "form" */
567
ptr2 = strp_pntr(2); /* get stripped string of "label" */
569
AG_AXIS( *type, data, *lspace, ptr1, ptr2);
573
/*==========================================================================*/
575
/*** void AG_ORAX ( type, ends, data, form, label ) ***/
577
ROUTINE AGL14 (type, ends, data )
583
ptr1 = strp_pntr(1); /* get stripped string of "form" */
584
ptr2 = strp_pntr(2); /* get stripped string of "label" */
586
AG_ORAX( *type, ends, data, ptr1, ptr2);
590
ROUTINE AGHIST (xv,yv,np,mode,join)
598
AG_HIST ( xv, yv, *np, *mode, *join );
603
/*==========================================================================*/
605
/*** void AG_NLIN(x1,x2,y1,y2,string) ***/
607
ROUTINE AGL15 (x1,x2,y1,y2)
614
ptr1 = strp_pntr(1); /* get stripped string of "string" */
616
AG_NLIN ( *x1, *x2, *y1, *y2,ptr1);
621
/*==========================================================================*/
623
/*** void AG_FILL(x,y,n,space,angle,sset) ***/
625
ROUTINE AGL16(x,y,n,space,angle)
633
ptr1 = strp_pntr(1); /* get stripped string of "sset" */
635
AG_FILL( x, y, *n, *space, *angle, ptr1);