Magellan.xs

filter: Statementstmt 0.0% 0 / 65 Branchbran 0.0% 0 / 42 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 0.0% 0 / 107 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« blib/lib/GPS/Magellan/Coord.pm ↑ Summary test-data/ref.WAYPOINT.dump »
1 #include "EXTERN.h"
2 #include "perl.h"
3 #include "XSUB.h"
4  
5 #include "ppport.h"
6  
7 #include <gpslib/magellan.h>
8 #include <gpslib/serial.h>
9 #include <gpslib/gps.h>
10  
11  
12 /* Global Data */
13  
14 #define MY_CXT_KEY "GPS::Magellan::_guts" XS_VERSION
15  
16  
17 typedef struct {
18 /* Put Global Data in here */
19 int Serial; /* you can access this elsewhere as MY_CXT.Serial */
20 } my_cxt_t;
21  
22 START_MY_CXT
23  
24 int Serial;
25 int handshaking;
26  
27  
28 MODULE = GPS::Magellan PACKAGE = GPS::Magellan
29  
30 BOOT:
31 {
32 MY_CXT_INIT;
33 /* If any of the fields in the my_cxt_t struct need
34 to be initialised, do it here.
35 */
36 }
37  
38  
39 int
40 ClosePort()
41  
42  
43 SV *
44 magellan_findmessage(Prefix)
45 char * Prefix
46 PREINIT:
47 0 char msg[MAXLEN] = "";
48 int rc;
49 CODE:
50 0 ▶ if(Prefix == NULL || ! strcmp(Prefix, "")){
Branch: 2 branches
BranchTrueFalseTotal
if(Prefix == NULL || ! strcmp(Prefix, "")){ 0 0 0
if(Prefix == NULL || ! strcmp(Prefix, "")){ 0 0 0
51 0 croak("magellan_findmessage(): need PREFIX.\n");
52 0 XSRETURN_UNDEF;
53 }
54 0 rc = MagFindMessage(Prefix, (char *)&msg, MAXLEN);
55 0 ▶ if(rc){
Branch: 1 branch
BranchTrueFalseTotal
if(rc){ 0 0 0
56 0 XSRETURN_UNDEF;
57 }
58 0 RETVAL = newSVpv(msg, 0);
59 OUTPUT:
60 RETVAL
61  
62 int
63 OpenPort(port)
64 char * port
65  
66 int
67 ReadMessage(Message, MaxLen)
68 char * Message
69 int MaxLen
70  
71 int
72 MagWriteMessageSum(Message)
73 char * Message
74  
75 int
76 MagWriteMessageNoAck(Message)
77 char * Message
78  
79  
80 int
81 WriteMessage(Message)
82 char * Message
83  
84 int
85 magellan_del_waypoint(wptname)
86 char * wptname
87  
88 MWpt *
89 magellan_dl_waypoints(cmd)
90 char * cmd
91  
92 void
93 magellan_handoff()
94  
95 void
96 magellan_handon()
97  
98 int
99 magellan_init()
100  
101 void
102 magellan_ul_waypoints(FName)
103 char * FName
104  
105 void
106 magellan_get_linked_list(List)
107 MWpt *List
108 PREINIT:
109 MWpt *Cur;
110 SV *sv_coord;
111 PPCODE:
112 0 ▶ if(List == NULL){
Branch: 1 branch
BranchTrueFalseTotal
if(List == NULL){ 0 0 0
113 0 croak("magellan_get_linked_list(): got NULL.\n");
114 XSRETURN_UNDEF;
115 }
116  
117 0 Cur = List->Next;
118  
119 0 ▶ while (Cur != NULL) {
Branch: 1 branch
BranchTrueFalseTotal
while (Cur != NULL) { 0 0 0
120 0 sv_coord = sv_newmortal();
121 0 sv_setref_pv(sv_coord, "MWptPtr", (void *) Cur);
122 0 ▶ XPUSHs(sv_coord);
Branch: 1 branch
BranchTrueFalseTotal
XPUSHs(sv_coord); 0 0 0
123 0 Cur = Cur->Next;
124 }
125  
126  
127  
128 MODULE = GPS::Magellan PACKAGE = MWpt
129  
130 MWpt *
131 _to_ptr(THIS)
132 MWpt THIS = NO_INIT
133 PROTOTYPE: $
134 CODE:
135 0 ▶ if (sv_derived_from(ST(0), "MWpt")) {
Branch: 1 branch
BranchTrueFalseTotal
if (sv_derived_from(ST(0), "MWpt")) { 0 0 0
136 STRLEN len;
137 0 char *s = SvPV((SV*)SvRV(ST(0)), len);
138 0 ▶ if (len != sizeof(THIS))
Branch: 1 branch
BranchTrueFalseTotal
if (len != sizeof(THIS)) 0 0 0
139 0 croak("Size %d of packed data != expected %d",
140 len, sizeof(THIS));
141 0 RETVAL = (MWpt *)s;
142 }
143 else
144 0 croak("THIS is not of type MWpt");
145 OUTPUT:
146 RETVAL
147  
148 MWpt
149 new(CLASS)
150 char *CLASS = NO_INIT
151 PROTOTYPE: $
152 CODE:
153 0 Zero((void*)&RETVAL, sizeof(RETVAL), char);
154 OUTPUT:
155 RETVAL
156  
157 MODULE = GPS::Magellan PACKAGE = MWptPtr
158  
159 double
160 Latitude(THIS, __value = NO_INIT)
161 MWpt * THIS
162 double __value
163 PROTOTYPE: $;$
164 CODE:
165 0 ▶ if (items > 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items > 1) 0 0 0
166 0 THIS->Latitude = __value;
167 0 ▶ RETVAL = THIS->Latitude;
Branch: 1 branch
BranchTrueFalseTotal
RETVAL = THIS->Latitude; 0 0 0
168 OUTPUT:
169 RETVAL
170  
171 char
172 LatDir(THIS, __value = NO_INIT)
173 MWpt * THIS
174 char __value
175 PROTOTYPE: $;$
176 CODE:
177 0 ▶ if (items > 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items > 1) 0 0 0
178 0 THIS->LatDir = __value;
179 0 RETVAL = THIS->LatDir;
180 OUTPUT:
181 RETVAL
182  
183 double
184 Longitude(THIS, __value = NO_INIT)
185 MWpt * THIS
186 double __value
187 PROTOTYPE: $;$
188 CODE:
189 0 ▶ if (items > 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items > 1) 0 0 0
190 0 THIS->Longitude = __value;
191 0 ▶ RETVAL = THIS->Longitude;
Branch: 1 branch
BranchTrueFalseTotal
RETVAL = THIS->Longitude; 0 0 0
192 OUTPUT:
193 RETVAL
194  
195 char
196 LongDir(THIS, __value = NO_INIT)
197 MWpt * THIS
198 char __value
199 PROTOTYPE: $;$
200 CODE:
201 0 ▶ if (items > 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items > 1) 0 0 0
202 0 THIS->LongDir = __value;
203 0 RETVAL = THIS->LongDir;
204 OUTPUT:
205 RETVAL
206  
207 long
208 Altitude(THIS, __value = NO_INIT)
209 MWpt * THIS
210 long __value
211 PROTOTYPE: $;$
212 CODE:
213 0 ▶ if (items > 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items > 1) 0 0 0
214 0 THIS->Altitude = __value;
215 0 ▶ RETVAL = THIS->Altitude;
Branch: 1 branch
BranchTrueFalseTotal
RETVAL = THIS->Altitude; 0 0 0
216 OUTPUT:
217 RETVAL
218  
219 char
220 AltType(THIS, __value = NO_INIT)
221 MWpt * THIS
222 char __value
223 PROTOTYPE: $;$
224 CODE:
225 0 ▶ if (items > 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items > 1) 0 0 0
226 0 THIS->AltType = __value;
227 0 RETVAL = THIS->AltType;
228 OUTPUT:
229 RETVAL
230  
231 char *
232 Name(THIS, __value = NO_INIT)
233 MWpt * THIS
234 char *__value
235 PROTOTYPE: $;$
236 CODE:
237 0 ▶ if (items > 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items > 1) 0 0 0
238 0 strcpy(THIS->Name, __value);
239 0 RETVAL = THIS->Name;
240 OUTPUT:
241 RETVAL
242  
243 char *
244 Desc(THIS, __value = NO_INIT)
245 MWpt * THIS
246 char *__value
247 PROTOTYPE: $;$
248 CODE:
249 0 ▶ if (items > 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items > 1) 0 0 0
250 0 strcpy(THIS->Desc, __value);
251 0 RETVAL = THIS->Desc;
252 OUTPUT:
253 RETVAL
254  
255 char
256 Icon(THIS, __value = NO_INIT)
257 MWpt * THIS
258 char __value
259 PROTOTYPE: $;$
260 CODE:
261 0 ▶ if (items > 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items > 1) 0 0 0
262 0 THIS->Icon = __value;
263 0 RETVAL = THIS->Icon;
264 OUTPUT:
265 RETVAL
266  
267 struct mWpT *
268 Next(THIS, __value = NO_INIT)
269 MWpt * THIS
270 struct mWpT * __value
271 PROTOTYPE: $;$
272 CODE:
273 0 ▶ if (items > 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items > 1) 0 0 0
274 0 THIS->Next = __value;
275 0 RETVAL = THIS->Next;
276 OUTPUT:
277 RETVAL
278  
279 void
280 Dump(THIS)
281 MWpt * THIS
282 CODE:
283 0 fprintf(stderr, "----------------------\n");
284 0 fprintf(stderr, "WPT: %s\n", THIS->Name);
285 0 fprintf(stderr, "----------------------\n");
286 0 fprintf(stderr, "Desc: %s\n", THIS->Desc);
287 0 fprintf(stderr, "Latitude: %08.3f\n", THIS->Latitude);
288 0 fprintf(stderr, "LatDir: %08.3f\n", THIS->LatDir);
289 0 fprintf(stderr, "Longitude: %08.3f\n", THIS->Longitude);
290 0 fprintf(stderr, "LongDir: %08.3f\n", THIS->LongDir);
291 0 fprintf(stderr, "Altitude: %08.3f\n", THIS->Altitude);
292 0 fprintf(stderr, "AltType: %08.3f\n", THIS->AltType);
293 0 fprintf(stderr, "Icon: %c\n", THIS->Icon);
294 0 fprintf(stderr, "----------------------\n");
295  
« blib/lib/GPS/Magellan/Coord.pm ↑ Summary test-data/ref.WAYPOINT.dump »