1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
|
/***************************************************************************
*
* VOCF77.C -- Fortran binding for the VOClient interface. As part of
* the binding we map the interface procedure names and convert string
* constants as needed per Fortran rules. Note that another aspect of
* the fortran calling convention is that the length of strings in the
* argument list are appended to the call stack. As C code we need to
* take this into account when defining the interface.
*
* M. Fitzpatrick, NOAO, Jul 2006
*
**************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#include <errno.h>
#define _VOCLIENT_LIB_
#include "VOClient.h"
/* Fortran Interface Definitions.
*
* Fortran compilers on various platforms may append one or more trailing
* underscores to symbol names, we'll use macros for the interface names
* and use defines to see what the symbol name is.
*/
#ifdef _NO_US_
#define VF_INITVOCLIENT vfinitvoclient
#define VF_CLOSEVOCLIENT vfclosevoclient
#define VF_ABORTVOCLIENT vfabortvoclient
#define VF_DBGLEVEL vfdbglevel
#define VF_VALIDATE vfvalidate
#define VF_MKFNAME vfmkfname
#else
#define VF_INITVOCLIENT vfinitvoclient_
#define VF_CLOSEVOCLIENT vfclosevoclient_
#define VF_ABORTVOCLIENT vfabortvoclient_
#define VF_DBGLEVEL vfdbglevel_
#define VF_VALIDATE vfvalidate
#define VF_MKFNAME vfmkfname_
#endif
/* Function prototypes.
*/
void VF_INITVOCLIENT (char *opts, int *ier, int len);
void VF_CLOSEVOCLIENT (int *shutdown, int *ier);
void VF_ABORTVOCLIENT (int *code, char *msg, int *ier, int len);
void VF_DBGLEVEL (int *level);
void VF_VALIDATE (int *hcode, int *flag);
void VF_MKFNAME (char *root, int *num, char *fname, int *len,
int rlen, int flen);
/** Private interface declarations.
**/
extern char *sstrip (char *instr, int len);
extern void spad (char *outstr, int len);
extern int typecode (char *typestr);
extern void voc_debugLevel ();
/******************************************************************************
** OPENVOCLIENT -- Open and initialize the VOClient interface.
*/
void
VF_INITVOCLIENT (char *opts, int *ier, int len)
{
char *_opts = sstrip (opts, len);
*ier = voc_initVOClient (_opts);
free ((char *) _opts);
}
/******************************************************************************
** CLOSEVOCLIENT -- Close and free the VOClient interface.
*/
void
VF_CLOSEVOCLIENT (int *shutdown, int *ier)
{
voc_closeVOClient (*shutdown);
*ier = OK;
}
/******************************************************************************
** ABORTVOCLIENT -- Close the VOClient interface and abort the application.
*/
void
VF_ABORTVOCLIENT (int *code, char *msg, int *ier, int len)
{
char *_msg = sstrip (msg, len);
voc_abortVOClient (*code, _msg);
*ier = OK;
free ((char *) _msg);
}
/******************************************************************************
** VALIDATE -- Validate an object in the daemon.
*/
void
VF_VALIDATE (int *hcode, int *flag) { *flag = voc_validateObject (*hcode); }
/******************************************************************************
** DEBUGLEVEL -- Set the package debugging output level.
*/
void
VF_DBGLEVEL (int *level) { voc_debugLevel(*level); }
/******************************************************************************
** MKFNAME -- Utility procedure for creating a file name.
*/
void
VF_MKFNAME (char *root, int *num, char *fname, int *len, int rlen, int flen)
{
memset (fname, 0, flen);
sprintf (fname, sstrip (root,rlen), *num);
*len = strlen (fname);
spad (fname, flen);
}
|