Linuxpops
3.01.04
Spectral Anaysis Package for Single Dish Data
Main Page
Related Pages
Classes
Files
File List
File Members
All
Classes
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Pages
parseProto.c
Go to the documentation of this file.
1
/*
2
Copyright 2021 Arizona Board of Regents on behalf of the University of Arizona.
3
4
For commercial uses, to obtain a license to sell and or sublicense copies of
5
the Software please contact the University of Arizona at Tech Launch Arizona:
6
lewish@tla.arizona.edu.
7
8
Permission is hereby granted, free of charge, to any person obtaining a copy
9
of this software and associated documentation files (the "Software"), to deal
10
in the Software without restriction for non-commercial use educational and
11
research purposes, including without limitation the rights to use, copy,
12
modify, merge, publish, distribute, and to permit persons to whom the Software
13
is furnished to do so, subject to the following conditions:
14
15
The entire above copyright notice and this permission notice shall be included
16
in all copies or substantial portions of the Software.
17
18
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
SOFTWARE.
25
26
1. Additional Required Provisions
27
28
1.1. Arbitration. The parties agree that if a dispute arises between them
29
concerning this Agreement, the parties may be required to submit the matter to
30
arbitration pursuant to Arizona law.
31
32
1.2. Applicable Law and Venue. This Agreement shall be interpreted pursuant
33
to the laws of the State of Arizona. Any arbitration or litigation between the
34
Parties shall be conducted in Pima County, ARIZONA, and LICENSEE hereby
35
submits to venue and jurisdiction in Pima County, ARIZONA.
36
37
1.3. Non-Discrimination. The Parties agree to be bound by state and federal
38
laws and regulations governing equal opportunity and non-discrimination and
39
immigration.
40
41
1.4. Appropriation of Funds. The Parties recognize that performance by
42
ARIZONA may depend upon appropriation of funds by the State Legislature of
43
ARIZONA. If the Legislature fails to appropriate the necessary funds, or if
44
ARIZONA’S appropriation is reduced during the fiscal year, ARIZONA may cancel
45
this Agreement without further duty or obligation. ARIZONA will notify
46
LICENSEE as soon as reasonably possible after it knows of the loss of funds.
47
48
1.5. Conflict of Interest. This Agreement is subject to the provisions of
49
A.R.S. 38-511 and other conflict of interest regulations. Within three years
50
of the EFFECTIVE DATE, ARIZONA may cancel this Agreement if any person
51
significantly involved in initiating, negotiating, drafting, securing, or
52
creating this Agreement for or on behalf of ARIZONA becomes an employee or
53
consultant in any capacity of LICENSEE with respect to the subject matter of
54
this Agreement.
55
56
*/
57
58
59
#include "
extern.h
"
60
61
#define MAX_PROTO_FILES 128
62
#define MAX_PROTO_FUNCS 128
63
64
struct
PROTO_LIST
{
65
int
used
;
66
int
count
;
67
char
file
[256];
68
char
functions
[
MAX_PROTO_FUNCS
][
MAX_PROTO_FUNCS
];
69
};
70
71
struct
PROTO_LIST
protos
[
MAX_PROTO_FILES
];
72
73
int
loadProto
()
74
{
75
int
findx, rindx;
76
char
*cp, *cp1, *cp2, *string, inbuf[256], fname[256];
77
FILE *
fp
;
78
79
cp = getenv(
"HOST"
);
80
if
(cp)
81
{
82
if
(
strcmp
(cp,
"helix"
) &&
strcmp
(cp,
"plas"
))
83
{
84
st_report
(
"Not loading proto.h"
);
85
return
(1);
86
}
87
}
88
89
cp = getenv(
"LINUXPOPS_HOME"
);
90
if
(cp)
91
{
92
sprintf(fname,
"%s/linuxpops/proto.h"
, cp);
93
}
94
else
95
{
96
st_fail
(
"LINUXPOPS_HOME not defined"
);
97
return
(1);
98
}
99
100
if
((fp = fopen(fname,
"r"
) ) <= (FILE *)0)
101
{
102
st_fail
(
"Unable to open file %s"
, fname);
103
return
(1);
104
}
105
106
findx = -1;
107
rindx = 0;
108
109
while
((
string
= fgets(inbuf,
sizeof
(inbuf), fp)) != NULL)
110
{
111
if
(!strncmp(inbuf,
"/*"
, 2))
112
{
113
findx++;
114
cp = index(inbuf+3,
' '
);
115
if
(cp)
116
{
117
*cp =
'\0'
;
118
}
119
120
strcpy(
protos
[findx].
file
, inbuf+3);
121
122
protos
[findx].
used
= 1;
123
124
rindx = 0;
125
}
126
else
/* It's a functions name */
127
{
128
if
(!strncmp(inbuf,
"int "
, 4))
/* Commands all return int's */
129
{
130
cp1 = index(inbuf,
' '
);
/* Find the first space */
131
cp2 = index(inbuf,
'('
);
/* Find the end of the function name */
132
if
(cp2)
133
{
134
*cp2 =
'\0'
;
135
}
136
137
strcpy(
protos
[findx].
functions
[rindx++], cp1+1);
138
139
protos
[findx].
count
= rindx;
140
}
141
}
142
}
143
144
st_report
(
"Found %d source files"
, findx);
145
146
fclose(fp);
147
148
return
(0);
149
}
150
151
152
/* Return the filename containing the function; Used for "codeview" */
153
int
findFunction
(func,
file
)
154
char *func, *
file
;
155
{
156
int
i, j;
157
158
for
(i=0;i<
MAX_PROTO_FILES
;i++)
159
{
160
for
(j=0;j<
protos
[i].
count
; j++)
161
{
162
if
(!
strcmp
(func,
protos
[i].
functions
[j]))
163
{
164
strcpy(file,
protos
[i].file);
165
return
(0);
166
}
167
}
168
}
169
170
st_fail
(
"Function: %s, not found"
, func);
171
172
return
(1);
173
}
174
findFunction
int findFunction(char *func, char *file)
Definition:
parseProto.c:153
PROTO_LIST::used
int used
Definition:
parseProto.c:65
protos
struct PROTO_LIST protos[MAX_PROTO_FILES]
Definition:
parseProto.c:71
MAX_PROTO_FILES
#define MAX_PROTO_FILES
Definition:
parseProto.c:61
fp
FILE * fp
Definition:
linuxpops.c:70
PROTO_LIST::count
int count
Definition:
parseProto.c:66
st_fail
void st_fail()
strcmp
int strcmp()
extern.h
MAX_PROTO_FUNCS
#define MAX_PROTO_FUNCS
Definition:
parseProto.c:62
PROTO_LIST
Definition:
parseProto.c:64
st_report
void st_report()
PROTO_LIST::file
char file[256]
Definition:
parseProto.c:67
PROTO_LIST::functions
char functions[MAX_PROTO_FUNCS][MAX_PROTO_FUNCS]
Definition:
parseProto.c:68
loadProto
int loadProto()
Definition:
parseProto.c:73
linuxpops
parseProto.c
Generated on Mon Feb 21 2022 20:37:02 for Linuxpops by
1.8.5