]>
Commit | Line | Data |
---|---|---|
5580185e | 1 | /* |
2 | * $Source$ | |
3 | * $Header$ | |
4 | */ | |
5 | ||
6 | #ifndef lint | |
7 | static char *rcsid_gdb_stype_c = "$Header$"; | |
d9f43d51 | 8 | #endif |
5580185e | 9 | |
10 | ||
8fd777cf | 11 | /************************************************************************ |
12 | * | |
13 | * gdb_stype.c | |
14 | * | |
15 | * GDB - System Data Type Definitions | |
16 | * | |
17 | * Author: Noah Mendelsohn | |
18 | * Copyright: 1986 MIT Project Athena | |
19 | * For copying and distribution information, please see | |
20 | * the file <mit-copyright.h>. | |
21 | * | |
22 | * This file initializes the definitions for all system defined | |
23 | * data types, and it includes the type specific semantic routines | |
24 | * for each of the system defined types. | |
25 | * | |
26 | * The initialization routine which adds these type definitions | |
27 | * to the type definition table is at the end of this source file. | |
28 | * | |
29 | ************************************************************************ | |
30 | * | |
31 | * This file is organized into one section for each system | |
32 | * defined type followed at the end by a final section which | |
33 | * initializes the type tables. Each of the type specific | |
34 | * sections does #defines for each type specific parameter. The | |
35 | * gdb_i_stype initialization routine at the end of this source | |
36 | * file uses these defines to initialize the appropriate entry in | |
37 | * the type definition tables. | |
38 | * | |
39 | * NOTE: some of the type definitions in this file may be machine | |
40 | * dependent. | |
41 | * | |
42 | ************************************************************************/ | |
5580185e | 43 | |
0a5ff702 | 44 | #include <mit-copyright.h> |
5580185e | 45 | #include <stdio.h> |
8fd777cf | 46 | #include <string.h> |
5580185e | 47 | #include "gdb.h" |
5580185e | 48 | #include <netinet/in.h> /* for htonl routine */ |
8fd777cf | 49 | |
50 | ||
51 | /************************************************************************ | |
52 | * | |
53 | * INTEGER_T | |
54 | * | |
55 | ************************************************************************/ | |
5580185e | 56 | |
57 | #define IN_LEN (sizeof(int)) | |
58 | #define IN_ALI IN_LEN | |
59 | #define IN_NULL g_in_null | |
60 | #define IN_CDLEN g_in_cdlen | |
61 | #define IN_ENC g_in_enc | |
62 | #define IN_DEC g_in_dec | |
63 | #define IN_FORM g_in_form | |
64 | #define IN_NAME "INTEGER_T" | |
65 | ||
66 | #define IN_EXTERNSIZE 4 /* length of an encoded */ | |
67 | /* integer */ | |
68 | /*----------------------------------------------------------*/ | |
69 | /* | |
70 | /* g_in_null | |
71 | /* | |
72 | /* Fill in a null value for an integer. | |
73 | /* | |
74 | /*----------------------------------------------------------*/ | |
75 | ||
76 | int | |
77 | g_in_null(dp) | |
78 | char *dp; /* pointer to the data */ | |
79 | { | |
80 | *((int *)dp) = 0; /* fill in a null value */ | |
81 | } | |
82 | ||
83 | /*----------------------------------------------------------*/ | |
84 | /* | |
85 | /* g_in_cdlen | |
86 | /* | |
87 | /* Return coded length for an integer. We're currently | |
88 | /* using the Berkeley 'htonl' routine which converts | |
89 | /* an integer (actually a long, ahem!) to a canonical | |
90 | /* 4 byte form.> | |
91 | /* | |
92 | /*----------------------------------------------------------*/ | |
93 | ||
94 | ||
24582af9 | 95 | /*ARGSUSED*/ |
5580185e | 96 | int |
97 | g_in_cdlen(dp,hcon) | |
98 | char *dp; /* pointer to the data */ | |
99 | HALF_CONNECTION hcon; | |
100 | { | |
101 | return IN_EXTERNSIZE; | |
102 | } | |
103 | ||
104 | /*----------------------------------------------------------*/ | |
105 | /* | |
106 | /* g_in_enc | |
107 | /* | |
108 | /* Encode an integer for transmission | |
109 | /* | |
110 | /*----------------------------------------------------------*/ | |
111 | ||
24582af9 | 112 | /*ARGSUSED*/ |
d9f43d51 | 113 | char * |
5580185e | 114 | g_in_enc(dp, hcon, outp) |
115 | char *dp; /* pointer to data */ | |
116 | HALF_CONNECTION hcon; /* connection descriptor */ | |
117 | char *outp; /* place to put the output */ | |
118 | { | |
119 | register char *cp; /* next char in output */ | |
120 | register char *op = outp; | |
121 | register char *endp = outp+IN_EXTERNSIZE; | |
122 | ||
d9f43d51 | 123 | uint32 converted; /* the integer goes here */ |
5580185e | 124 | /* in network byte order*/ |
125 | ||
126 | /* | |
127 | * Put it in network format, then copy one byte at a time to | |
128 | * account for the fact that the RT has trouble with unaligned longs | |
129 | */ | |
130 | ||
d9f43d51 | 131 | converted = htonl(*(uint32 *)dp); |
5580185e | 132 | |
133 | cp = (char *)&converted; | |
134 | *op++ = *cp++; | |
135 | *op++ = *cp++; | |
136 | *op++ = *cp++; | |
137 | *op++ = *cp++; | |
138 | ||
d9f43d51 | 139 | return endp; /* return pointer to next */ |
5580185e | 140 | /* unused output byte*/ |
141 | } | |
142 | ||
143 | /*----------------------------------------------------------*/ | |
144 | /* | |
145 | /* g_in_dec | |
146 | /* | |
147 | /* Decode an integer from external form to local | |
148 | /* representation. | |
149 | /* | |
150 | /* | |
151 | /*----------------------------------------------------------*/ | |
152 | ||
24582af9 | 153 | /*ARGSUSED*/ |
d9f43d51 | 154 | char * |
5580185e | 155 | g_in_dec(outp, hcon, inp) |
156 | char *inp; /* pointer to data */ | |
157 | HALF_CONNECTION hcon; /* connection descriptor */ | |
158 | char *outp; /* place to put the output */ | |
159 | { | |
160 | register char *ip = inp; /* next byte of input */ | |
161 | int buffer; | |
162 | register char *bp; /* next byte in buffer */ | |
163 | ||
164 | /* | |
165 | * Copy a byte at a time to buffer to account for RT difficulties | |
166 | * with unaligned ints. | |
167 | */ | |
168 | bp = (char *)&buffer; | |
169 | *bp++ = *ip++; | |
170 | *bp++ = *ip++; | |
171 | *bp++ = *ip++; | |
172 | *bp++ = *ip++; | |
173 | ||
174 | /* | |
175 | * Convert it and return pointer to next byte of input. | |
176 | */ | |
177 | ||
178 | *(int *)outp = ntohl((u_long)buffer); | |
d9f43d51 | 179 | return ip; |
5580185e | 180 | } |
181 | ||
182 | /*----------------------------------------------------------*/ | |
183 | /* | |
184 | /* g_in_form | |
185 | /* | |
186 | /* Format an integer on output logging file for | |
187 | /* debugging. | |
188 | /* | |
189 | /*----------------------------------------------------------*/ | |
190 | ||
191 | int | |
192 | g_in_form(name, dp) | |
193 | char *name; /* string name of the field */ | |
194 | char *dp; /* pointer to the data */ | |
195 | { | |
196 | fprintf(gdb_log, "INTEGER_T\t%s=%d\n",name,(*(int *)dp)); | |
197 | } | |
8fd777cf | 198 | |
199 | ||
5580185e | 200 | /************************************************************************/ |
201 | /* | |
202 | /* STRING_T | |
203 | /* | |
204 | /************************************************************************/ | |
205 | ||
206 | #define ST_LEN (sizeof(STRING)) | |
d9f43d51 | 207 | #define ST_ALI (sizeof(char *)) |
5580185e | 208 | #define ST_NULL g_st_null |
209 | #define ST_CDLEN g_st_cdlen | |
210 | #define ST_ENC g_st_enc | |
211 | #define ST_DEC g_st_dec | |
212 | #define ST_FORM g_st_form | |
213 | #define ST_NAME "STRING_T" | |
214 | ||
215 | /*----------------------------------------------------------*/ | |
216 | /* | |
217 | /* g_st_null | |
218 | /* | |
219 | /* Fill in a null value for a string. | |
220 | /* | |
221 | /*----------------------------------------------------------*/ | |
222 | int | |
223 | g_st_null(dp) | |
224 | char *dp; /* pointer to the data */ | |
225 | { | |
226 | register STRING *stp = (STRING *)dp; /* re-type as string */ | |
227 | STRING_DATA(*stp) = NULL; /* no data */ | |
228 | MAX_STRING_SIZE(*stp) = 0; /* for cleanliness */ | |
229 | } | |
230 | ||
231 | /*----------------------------------------------------------*/ | |
232 | /* | |
233 | /* g_st_cdlen | |
234 | /* | |
235 | /* Return coded length for a string. We have to send the | |
236 | /* actual length of the data along with the data itself. | |
237 | /* For this reason, we leave space for a coded integer | |
238 | /* in addition to the data bytes. We actually call the | |
239 | /* integer coding routines to code the length. | |
240 | /* | |
241 | /* Note that a separate type understanding null termination | |
242 | /* might be an interesting optimization someday. | |
243 | /* | |
244 | /*----------------------------------------------------------*/ | |
245 | ||
246 | int | |
247 | g_st_cdlen(dp,hcon) | |
248 | char *dp; /* pointer to the data */ | |
249 | HALF_CONNECTION hcon; | |
250 | { | |
251 | register STRING *stp = (STRING *)dp; /* re-type as string */ | |
252 | ||
253 | return (MAX_STRING_SIZE(*stp) + | |
254 | g_in_cdlen((char *)&MAX_STRING_SIZE(*stp),hcon)); | |
255 | } | |
256 | ||
257 | /*----------------------------------------------------------*/ | |
258 | /* | |
259 | /* g_st_enc | |
260 | /* | |
261 | /* Encode a string for transmission | |
262 | /* | |
263 | /*----------------------------------------------------------*/ | |
264 | ||
d9f43d51 | 265 | char * |
5580185e | 266 | g_st_enc(dp, hcon, outp) |
267 | char *dp; /* pointer to data */ | |
268 | HALF_CONNECTION hcon; /* connection descriptor */ | |
269 | char *outp; /* place to put the output */ | |
270 | { | |
271 | register STRING *stp = (STRING *)dp; /* re-type as string */ | |
272 | int len; | |
273 | register char *nextp; /* place to put next output */ | |
274 | /* byte */ | |
275 | /* | |
276 | * Use the integer coding routine to get the length encoded first | |
277 | */ | |
278 | ||
279 | len = MAX_STRING_SIZE(*stp); /* length of both source */ | |
280 | /* and coded form*/ | |
281 | nextp = (char *)g_in_enc((char *)&len, hcon, outp); | |
282 | ||
283 | /* | |
284 | * Now, copy the data itself after the encoded integer length | |
285 | */ | |
286 | if (len > 0) | |
8fd777cf | 287 | memcpy(nextp, STRING_DATA(*stp), len); |
5580185e | 288 | /* copy the data without */ |
289 | /* changing representation*/ | |
d9f43d51 | 290 | return nextp+len; |
5580185e | 291 | } |
292 | ||
293 | /*----------------------------------------------------------*/ | |
294 | /* | |
295 | /* g_st_dec | |
296 | /* | |
297 | /* Decode a string from external form. We always | |
298 | /* allocate new space for the string, intentionally | |
299 | /* ignoring any which may have been in use before. If we | |
300 | /* freed it, we would not be robust against calls on | |
301 | /* uninitialized fields. This may have nasty side | |
302 | /* effects if the intention was to leave 'gas' at the end | |
303 | /* of the string, but we want to accurately copy the | |
304 | /* data. Note that string_free is robust against null | |
305 | /* pointers. | |
306 | /* | |
307 | /*----------------------------------------------------------*/ | |
308 | ||
d9f43d51 | 309 | char * |
5580185e | 310 | g_st_dec(outp, hcon, inp) |
311 | char *inp; /* pointer to input data */ | |
312 | HALF_CONNECTION hcon; /* connection descriptor */ | |
313 | char *outp; /* place to put the output */ | |
314 | { | |
315 | register STRING *stp = (STRING *)outp; /* re-type as string */ | |
316 | int len; | |
317 | register char *nextp; /* next byte to scan */ | |
318 | /* | |
319 | * Use the integer coding routine to get the length encoded first | |
320 | */ | |
321 | ||
322 | nextp = (char *)g_in_dec((char *)&len, hcon, inp); | |
323 | ||
324 | ||
325 | /* | |
326 | * Allocate memory for the string. If length is 0, then null it | |
327 | * out. Note that we had considered freeing any existing strings | |
328 | * which might be there, but this turns out to cause lots of | |
329 | * trouble for the many callers who don't want to initialize before | |
330 | * a decode. | |
331 | */ | |
332 | if (len == 0) { | |
333 | STRING_DATA(*stp) = NULL; | |
334 | MAX_STRING_SIZE(*stp) = 0; | |
d9f43d51 | 335 | return nextp; |
5580185e | 336 | } |
337 | (void) string_alloc(stp, len); /* this sets string length */ | |
338 | /* in addition to doing the */ | |
339 | /* allocation */ | |
340 | ||
341 | /* | |
342 | * Now, copy the data itself | |
343 | */ | |
8fd777cf | 344 | memcpy(STRING_DATA(*stp), nextp, len); /* copy the data without */ |
5580185e | 345 | /* changing representation*/ |
d9f43d51 | 346 | return nextp+len; |
5580185e | 347 | } |
348 | ||
349 | /*----------------------------------------------------------*/ | |
350 | /* | |
351 | /* g_st_form | |
352 | /* | |
353 | /* Format a string on output logging file for | |
354 | /* debugging. | |
355 | /* | |
356 | /*----------------------------------------------------------*/ | |
357 | ||
358 | int | |
359 | g_st_form(name, dp) | |
360 | char *name; /* string name of the field */ | |
361 | char *dp; /* pointer to the data */ | |
362 | { | |
363 | register STRING *stp = (STRING *)dp; /* re-type as string */ | |
364 | int len; | |
365 | register char *cp; /* next char to print */ | |
366 | register char *past_end; /* 1st one not to print */ | |
367 | ||
368 | len = MAX_STRING_SIZE(*stp); | |
369 | fprintf(gdb_log, "STRING_T\t%s[%d]=\"", name,len); | |
370 | ||
371 | if (len == 0 ) { | |
372 | fprintf(gdb_log, "\"\n"); | |
373 | return; | |
374 | } | |
375 | ||
376 | ||
377 | cp = STRING_DATA(*stp); | |
378 | past_end = cp + len; | |
379 | ||
380 | while (cp < past_end) | |
381 | (void) putc(*cp++, gdb_log); | |
382 | ||
383 | fprintf(gdb_log,"\"\n"); | |
384 | } | |
8fd777cf | 385 | |
386 | ||
5580185e | 387 | /************************************************************************/ |
388 | /* | |
389 | /* REAL_T | |
390 | /* | |
391 | /************************************************************************/ | |
392 | ||
393 | #define RL_LEN (sizeof(double)) | |
394 | #define RL_ALI RL_LEN | |
395 | #define RL_NULL g_rl_null | |
396 | #define RL_CDLEN g_rl_cdlen | |
397 | #define RL_ENC g_rl_enc | |
398 | #define RL_DEC g_rl_dec | |
399 | #define RL_FORM g_rl_form | |
400 | #define RL_NAME "REAL_T" | |
401 | ||
402 | #define RL_EXTERNSIZE 32 /* length of ascii coding */ | |
403 | /* must change lengths in */ | |
404 | /* encode and decode */ | |
405 | /* routines to match*/ | |
406 | /*----------------------------------------------------------*/ | |
407 | /* | |
408 | /* g_rl_null | |
409 | /* | |
410 | /* Fill in a null value for an real. | |
411 | /* | |
412 | /*----------------------------------------------------------*/ | |
413 | int | |
414 | g_rl_null(dp) | |
415 | char *dp; /* pointer to the data */ | |
416 | { | |
417 | *((double *)dp) = 0.0; /* fill in a null value */ | |
418 | } | |
419 | ||
420 | /*----------------------------------------------------------*/ | |
421 | /* | |
422 | /* g_rl_cdlen | |
423 | /* | |
424 | /* Return coded length for an real. For now, we just | |
425 | /* code as a 12 digit ASCII converted string. Obviously, | |
426 | /* we can do much better in the future. | |
427 | /* | |
428 | /*----------------------------------------------------------*/ | |
429 | ||
430 | ||
24582af9 | 431 | /*ARGSUSED*/ |
5580185e | 432 | int |
433 | g_rl_cdlen(dp,hcon) | |
434 | char *dp; /* pointer to the data */ | |
435 | HALF_CONNECTION hcon; | |
436 | { | |
437 | return RL_EXTERNSIZE; | |
438 | } | |
439 | ||
440 | /*----------------------------------------------------------*/ | |
441 | /* | |
442 | /* g_rl_enc | |
443 | /* | |
444 | /* Encode an real for transmission | |
445 | /* | |
446 | /*----------------------------------------------------------*/ | |
447 | ||
24582af9 | 448 | /*ARGSUSED*/ |
d9f43d51 | 449 | char * |
5580185e | 450 | g_rl_enc(dp, hcon, outp) |
451 | char *dp; /* pointer to data */ | |
452 | HALF_CONNECTION hcon; /* connection descriptor */ | |
453 | char *outp; /* place to put the output */ | |
454 | { | |
455 | register char *cp; /* next char in output */ | |
456 | register char *endp = outp+RL_EXTERNSIZE; | |
457 | ||
458 | /* | |
459 | * Convert the data into printable ASCII in the output stream | |
460 | * Note that the width in the format below must be less than | |
461 | * RL_EXTERNSIZE, because sprintf needs space for its terminating | |
462 | * null. | |
463 | */ | |
464 | ||
465 | (void) sprintf(outp,"%30le",*((double *)dp)); | |
466 | ||
467 | /* | |
468 | * Sprintf produces output of unpredictable length, and with | |
469 | * a null termination. Pad it out to the desired length. | |
470 | */ | |
471 | ||
472 | cp = outp + strlen(outp); /* find out where convertd */ | |
473 | /* string stops*/ | |
474 | while (cp < endp) | |
475 | *cp++ = ' '; /* pad to desired length */ | |
476 | ||
d9f43d51 | 477 | return outp+RL_EXTERNSIZE; /* return pointer to next */ |
5580185e | 478 | /* unused output byte*/ |
479 | } | |
480 | ||
481 | /*----------------------------------------------------------*/ | |
482 | /* | |
483 | /* g_rl_dec | |
484 | /* | |
485 | /* Decode an real from external form | |
486 | /* | |
487 | /*----------------------------------------------------------*/ | |
488 | ||
24582af9 | 489 | /*ARGSUSED*/ |
d9f43d51 | 490 | char * |
5580185e | 491 | g_rl_dec(outp, hcon, inp) |
492 | char *inp; /* pointer to data */ | |
493 | HALF_CONNECTION hcon; /* connection descriptor */ | |
494 | char *outp; /* place to put the output */ | |
495 | { | |
496 | (void) sscanf(inp,"%30le", (double *)outp); | |
d9f43d51 | 497 | return inp+RL_EXTERNSIZE; |
5580185e | 498 | } |
499 | ||
500 | /*----------------------------------------------------------*/ | |
501 | /* | |
502 | /* g_rl_form | |
503 | /* | |
504 | /* Format an real on output logging file for | |
505 | /* debugging. | |
506 | /* | |
507 | /*----------------------------------------------------------*/ | |
508 | ||
509 | int | |
510 | g_rl_form(name, dp) | |
511 | char *name; /* string name of the field */ | |
512 | char *dp; /* pointer to the data */ | |
513 | { | |
514 | fprintf(gdb_log, "REAL_T\t\t%s=%le\n",name,*((double *)dp) ); | |
515 | } | |
8fd777cf | 516 | |
517 | ||
5580185e | 518 | /************************************************************************/ |
519 | /* | |
520 | /* DATE_T | |
521 | /* | |
522 | /************************************************************************/ | |
523 | ||
524 | #define DT_LEN 25 /* see ingres definition */ | |
525 | #define DT_ALI 1 /* char data, need not align */ | |
526 | #define DT_NULL g_dt_null | |
527 | #define DT_CDLEN g_dt_cdlen | |
528 | #define DT_ENC g_dt_enc | |
529 | #define DT_DEC g_dt_dec | |
530 | #define DT_FORM g_dt_form | |
531 | #define DT_NAME "DATE_T" | |
532 | ||
533 | #define DT_EXTERNSIZE DT_LEN /* length of ascii coding */ | |
534 | /* must change lengths in */ | |
535 | /* encode and decode */ | |
536 | /* routines to match*/ | |
537 | /*----------------------------------------------------------*/ | |
538 | /* | |
539 | /* g_dt_null | |
540 | /* | |
541 | /* Fill in a null value for a date. | |
542 | /* | |
543 | /*----------------------------------------------------------*/ | |
544 | int | |
545 | g_dt_null(dp) | |
546 | char *dp; /* pointer to the data */ | |
547 | { | |
548 | register char *cp = dp; /* next character to fill in */ | |
549 | register char *endp = dp + DT_LEN; | |
550 | ||
551 | /* | |
552 | * Fill the field with character blanks | |
553 | */ | |
554 | while (cp < endp) | |
555 | *cp++ = ' '; | |
556 | } | |
557 | ||
558 | /*----------------------------------------------------------*/ | |
559 | /* | |
560 | /* g_dt_cdlen | |
561 | /* | |
562 | /* Return coded length for an date. For now, we just | |
563 | /* code as a 25 digit ASCII converted string. | |
564 | /* | |
565 | /*----------------------------------------------------------*/ | |
566 | ||
567 | ||
24582af9 | 568 | /*ARGSUSED*/ |
5580185e | 569 | int |
570 | g_dt_cdlen(dp,hcon) | |
571 | char *dp; /* pointer to the data */ | |
572 | HALF_CONNECTION hcon; | |
573 | { | |
574 | return DT_EXTERNSIZE; | |
575 | } | |
576 | ||
577 | /*----------------------------------------------------------*/ | |
578 | /* | |
579 | /* g_dt_enc | |
580 | /* | |
581 | /* Encode a date for transmission | |
582 | /* | |
583 | /*----------------------------------------------------------*/ | |
584 | ||
24582af9 | 585 | /*ARGSUSED*/ |
d9f43d51 | 586 | char * |
5580185e | 587 | g_dt_enc(dp, hcon, outp) |
588 | char *dp; /* pointer to data */ | |
589 | HALF_CONNECTION hcon; /* connection descriptor */ | |
590 | char *outp; /* place to put the output */ | |
591 | { | |
592 | register char *ip = dp; /* next char in input */ | |
593 | register char *op = outp; /* next char in output */ | |
594 | register char *endp = op+DT_EXTERNSIZE; | |
595 | ||
596 | /* | |
597 | * Copy the input untransformed to the output | |
598 | */ | |
599 | ||
600 | while (op < endp) | |
601 | *op++ = *ip++; /* pad to desired length */ | |
602 | ||
d9f43d51 | 603 | return endp; /* return pointer to next */ |
5580185e | 604 | /* unused output byte*/ |
605 | } | |
606 | ||
607 | /*----------------------------------------------------------*/ | |
608 | /* | |
609 | /* g_dt_dec | |
610 | /* | |
611 | /* Decode an date from external form | |
612 | /* | |
613 | /*----------------------------------------------------------*/ | |
614 | ||
24582af9 | 615 | /*ARGSUSED*/ |
d9f43d51 | 616 | char * |
5580185e | 617 | g_dt_dec(outp, hcon, inp) |
618 | char *inp; /* pointer to data */ | |
619 | HALF_CONNECTION hcon; /* connection descriptor */ | |
620 | char *outp; /* place to put the output */ | |
621 | { | |
622 | register char *ip = inp; /* next char in input */ | |
623 | register char *op = outp; /* next char in output */ | |
624 | register char *endp = op+DT_EXTERNSIZE; | |
625 | ||
626 | /* | |
627 | * Copy the input untransformed to the output | |
628 | */ | |
629 | ||
630 | while (op < endp) | |
631 | *op++ = *ip++; /* pad to desired length */ | |
632 | ||
d9f43d51 | 633 | return endp; /* return pointer to next */ |
5580185e | 634 | /* unused output byte*/ |
635 | } | |
636 | ||
637 | /*----------------------------------------------------------*/ | |
638 | /* | |
639 | /* g_dt_form | |
640 | /* | |
641 | /* Format a date on output logging file for | |
642 | /* debugging. | |
643 | /* | |
644 | /*----------------------------------------------------------*/ | |
645 | ||
646 | int | |
647 | g_dt_form(name, dp) | |
648 | char *name; /* string name of the field */ | |
649 | char *dp; /* pointer to the data */ | |
650 | { | |
651 | char buf[DT_EXTERNSIZE+1]; | |
652 | ||
8fd777cf | 653 | memcpy(buf, dp, DT_EXTERNSIZE); /* copy date to buffer */ |
5580185e | 654 | buf[DT_EXTERNSIZE] = '\0'; /* null terminate it */ |
655 | fprintf(gdb_log, "DATE_T\t\t%s=%s\n",name,buf); | |
656 | } | |
8fd777cf | 657 | |
658 | ||
5580185e | 659 | /************************************************************************/ |
660 | /* | |
661 | /* TUPLE_DESCRIPTOR_T | |
662 | /* | |
663 | /* The external representation of a tuple descriptor will be to | |
664 | /* send the count of the number of fields, and then a one byte | |
665 | /* signed integer describing each type followed by all the | |
666 | /* corresponding null terminated strings. The tuple descriptor | |
667 | /* will really get re-created wth proper offsets and lengths upon | |
668 | /* receipt by the create_tuple_descriptor operation. | |
669 | /* | |
670 | /************************************************************************/ | |
671 | ||
672 | #define TPD_LEN (sizeof(TUPLE_DESCRIPTOR)) | |
673 | #define TPD_ALI (sizeof(TUPLE_DESCRIPTOR)) | |
674 | #define TPD_NULL g_tpd_null | |
675 | #define TPD_CDLEN g_tpd_cdlen | |
676 | #define TPD_ENC g_tpd_enc | |
677 | #define TPD_DEC g_tpd_dec | |
678 | #define TPD_FORM g_tpd_form | |
679 | #define TPD_NAME "TUPLE_DESCRIPTOR_T" | |
680 | ||
681 | /*----------------------------------------------------------*/ | |
682 | /* | |
683 | /* g_tpd_null | |
684 | /* | |
685 | /* Fill in a null value for a tuple_descriptor. | |
686 | /* | |
687 | /*----------------------------------------------------------*/ | |
688 | int | |
689 | g_tpd_null(dp) | |
690 | char *dp; /* pointer to the data */ | |
691 | { | |
692 | register TUPLE_DESCRIPTOR *tdp = (TUPLE_DESCRIPTOR *)dp; | |
693 | /* re-type as */ | |
694 | /* tuple_descriptor */ | |
695 | (*tdp) = NULL; /* no data */ | |
696 | } | |
697 | ||
698 | /*----------------------------------------------------------*/ | |
699 | /* | |
700 | /* g_tpd_cdlen | |
701 | /* | |
702 | /* Return coded length for a tuple_descriptor. | |
703 | /* | |
704 | /*----------------------------------------------------------*/ | |
705 | ||
706 | int | |
707 | g_tpd_cdlen(dp,hcon) | |
708 | char *dp; /* pointer to the data */ | |
709 | HALF_CONNECTION hcon; | |
710 | { | |
711 | register TUPLE_DESCRIPTOR tdp = *((TUPLE_DESCRIPTOR *)dp); | |
712 | /* re-type as */ | |
713 | /* tuple_descriptor */ | |
714 | register int coded_len; /* the value we're trying */ | |
715 | /* to compute */ | |
716 | ||
717 | /* | |
718 | * Validate the descriptor | |
719 | */ | |
720 | if (tdp == NULL) | |
721 | GDB_GIVEUP("g_tpd_cdlen (coded length) was given a null tuple descriptor\nthis may be due to an attempt to transmit invalid data") | |
722 | GDB_CHECK_TPD(tdp,"g_tpd_cdlen: compute coded length of tuple descriptor") | |
723 | ||
724 | coded_len = g_in_cdlen((char *)&(tdp->field_count),hcon); | |
725 | /* we're going to send */ | |
726 | /* the field count as a */ | |
727 | /* true integer*/ | |
728 | ||
729 | coded_len += tdp->str_len + tdp->field_count; | |
730 | /* space for all the */ | |
731 | /* strings, with nulls, */ | |
732 | /* and for the one byte */ | |
733 | /* types*/ | |
734 | ||
735 | return coded_len; | |
736 | ||
737 | } | |
738 | ||
739 | /*----------------------------------------------------------*/ | |
740 | /* | |
741 | /* g_tpd_enc | |
742 | /* | |
743 | /* Encode a tuple_descriptor for transmission | |
744 | /* | |
745 | /*----------------------------------------------------------*/ | |
746 | ||
d9f43d51 | 747 | char * |
5580185e | 748 | g_tpd_enc(dp, hcon, outp) |
749 | char *dp; /* pointer to data */ | |
750 | HALF_CONNECTION hcon; /* connection descriptor */ | |
751 | char *outp; /* place to put the output */ | |
752 | { | |
753 | register TUPLE_DESCRIPTOR tdp = *((TUPLE_DESCRIPTOR *)dp); | |
754 | /* re-type as */ | |
755 | /* tuple_descriptor */ | |
756 | register char *nextp; /* place to put next output */ | |
757 | /* byte */ | |
758 | register int i; /* a loop counter */ | |
759 | ||
760 | /* | |
761 | * Validate the descriptor | |
762 | */ | |
763 | if (tdp == NULL) | |
764 | GDB_GIVEUP("g_tpd_enc (encode) was given a null tuple descriptor\nthis may be due to an attempt to transmit invalid data") | |
765 | GDB_CHECK_TPD(tdp,"g_tpd_enc: encode tuple descriptor") | |
766 | ||
767 | /* | |
768 | * Use the integer coding routine to send the number of fields first | |
769 | */ | |
770 | /* and coded form*/ | |
771 | nextp = (char *)g_in_enc((char *)&(tdp->field_count), hcon, outp); | |
772 | ||
773 | /* | |
774 | * Next, put in the one byte codes for each of the field types | |
775 | */ | |
776 | ||
777 | for (i=0; i<tdp->field_count; i++) { | |
778 | *nextp++ = tdp->var[i].type & 0xff; /* put out the one byte */ | |
779 | /* type codes */ | |
780 | } | |
781 | ||
782 | /* | |
783 | * Finally, copy all the null terminated strings. | |
784 | */ | |
8fd777cf | 785 | memcpy(nextp,((char *)(tdp))+gdb_descriptor_length(tdp->field_count), |
786 | tdp->str_len); /* copy the string data all */ | |
5580185e | 787 | /* at once */ |
d9f43d51 | 788 | return nextp+tdp->str_len; |
5580185e | 789 | } |
790 | ||
791 | /*----------------------------------------------------------*/ | |
792 | /* | |
793 | /* g_tpd_dec | |
794 | /* | |
795 | /* Decode a tuple_descriptor from external form. For | |
796 | /* safety in memory management, we always re-allocate the | |
797 | /* space for the tuple_descriptor. If the pointer passed | |
798 | /* to us is not null, then we assume that it points to a | |
799 | /* legal tuple descriptor, which we first free. Because | |
800 | /* data representation may change, we must re-do the | |
801 | /* create-tuple-descriptor, so it can determine the local | |
802 | /* machine dependent representation and alignment rules | |
803 | /* for the data. | |
804 | /* | |
805 | /*----------------------------------------------------------*/ | |
806 | ||
807 | #define GDB_MAX_DECODED_FIELDS 100 | |
808 | ||
d9f43d51 | 809 | char * |
5580185e | 810 | g_tpd_dec(outp, hcon, inp) |
811 | char *inp; /* pointer to input data */ | |
812 | HALF_CONNECTION hcon; /* connection descriptor */ | |
813 | char *outp; /* place to put the output */ | |
814 | { | |
815 | register TUPLE_DESCRIPTOR *tdp = (TUPLE_DESCRIPTOR *)outp; | |
816 | /* re-type as */ | |
817 | /* tuple_descriptor */ | |
818 | int field_count; /* number of fields in the */ | |
819 | /* newly received descriptor*/ | |
820 | register int i; /* a loop counter */ | |
821 | ||
822 | register int tmp; /* working variable to hold */ | |
823 | /* type while they're being */ | |
824 | /* sign extended */ | |
825 | char *nextt; /* next byte to scan for */ | |
826 | /* a type code byte*/ | |
827 | char *nextn; /* next byte to scan for */ | |
828 | /* a string name */ | |
829 | char *field_names[GDB_MAX_DECODED_FIELDS]; | |
830 | /* put pointers to the */ | |
831 | /* field names here */ | |
832 | FIELD_TYPE field_types[GDB_MAX_DECODED_FIELDS]; | |
833 | /* put the field types in */ | |
834 | /* the array here*/ | |
835 | /* | |
836 | * Use the integer coding routine to get the number of fields | |
837 | */ | |
838 | ||
839 | nextt = (char *)g_in_dec((char *)&field_count, hcon, inp); | |
840 | if (field_count > GDB_MAX_DECODED_FIELDS) | |
841 | GDB_GIVEUP("g_tpd_dec: Trying to decode tuple descriptor with too many fields.\n") | |
842 | ||
843 | ||
844 | /* | |
845 | * For each field, pick up its type code, being sure to sign extend, | |
846 | * and a pointer to its string name. | |
847 | */ | |
848 | nextn = nextt + field_count; /* there is one byte of */ | |
849 | /* type info for each field, */ | |
850 | /* after that comes the */ | |
851 | /* first string. nextn */ | |
852 | /* now points to the first */ | |
853 | /* string */ | |
854 | for (i=0; i<field_count; i++) { | |
855 | tmp = *nextt++; /* type code, may need */ | |
856 | /* sign extension */ | |
857 | if (tmp & 0x80) | |
858 | tmp |= ((~0) ^ 0xff); /* sign extend if needed */ | |
859 | /* this is the most machine */ | |
860 | /* independent sign extension */ | |
861 | /* I could come up with. */ | |
862 | /* Presumes char is one byte, */ | |
863 | /* but makes no assumption */ | |
864 | /* about sizeof(int) */ | |
865 | field_types[i] = tmp; | |
866 | field_names[i] = nextn; /* pointer to name of the */ | |
867 | /* field */ | |
868 | nextn += strlen(nextn) +1; /* set up for possible name */ | |
869 | /* to follow */ | |
870 | } | |
871 | ||
872 | /* | |
873 | * In case there was already a tuple descriptor here, free it. | |
874 | */ | |
875 | ||
876 | delete_tuple_descriptor(*tdp); | |
877 | ||
878 | /* | |
879 | * Create a new descriptor based on the information we have received. | |
880 | */ | |
881 | *tdp = create_tuple_descriptor(field_count, field_names, field_types); | |
882 | ||
d9f43d51 | 883 | return nextn; |
5580185e | 884 | } |
885 | ||
886 | /*----------------------------------------------------------*/ | |
887 | /* | |
888 | /* g_tpd_form | |
889 | /* | |
890 | /* Format a tuple_descriptor on output logging file for | |
891 | /* debugging. | |
892 | /* | |
893 | /*----------------------------------------------------------*/ | |
894 | ||
895 | int | |
896 | g_tpd_form(name, dp) | |
897 | char *name; /* tuple_descriptor name of the field */ | |
898 | char *dp; /* pointer to the data */ | |
899 | { | |
900 | register TUPLE_DESCRIPTOR tdp = *((TUPLE_DESCRIPTOR *)dp); | |
901 | /* re-type as */ | |
902 | /* tuple_descriptor */ | |
903 | register int i; /* loop variable through */ | |
904 | /* field definitions */ | |
905 | ||
906 | ||
907 | /* | |
908 | * Handle the special case where the descriptor is null | |
909 | */ | |
910 | if (tdp == NULL) { | |
911 | fprintf(gdb_log, "TUPLE_DESCRIPTOR %s (loc=NULL)\n", name); | |
912 | return; | |
913 | } | |
914 | ||
915 | /* | |
916 | * Validate the descriptor | |
917 | */ | |
918 | GDB_CHECK_TPD(tdp,"g_tpd_form: format tuple descriptor") | |
919 | ||
920 | /* | |
921 | * Descriptor is not null | |
922 | */ | |
923 | fprintf(gdb_log, "TUPLE_DESCRIPTOR %s (loc=0x%x)\n", name, tdp); | |
924 | ||
925 | for (i=0; i<tdp->field_count; i++) { | |
926 | fprintf(gdb_log,"\tField Type Code = %3d %20s\tField Name=%s\n" , | |
927 | tdp->var[i].type, | |
928 | STR_PROPERTY(tdp->var[i].type,NAME_PROPERTY), | |
929 | tdp->var[i].name); | |
930 | } | |
931 | fprintf(gdb_log,"\n"); | |
932 | } | |
8fd777cf | 933 | |
934 | ||
5580185e | 935 | /************************************************************************/ |
936 | /* | |
937 | /* TUPLE_T | |
938 | /* | |
939 | /* There is a distinction between the type tuple_t and the | |
940 | /* type tuple_data_t. Tuple_t is a complete self-contained | |
941 | /* tuple, with its descriptor. It actually refers to the | |
942 | /* tuple variable itself, which is a pointer. Tuple_data | |
943 | /* is only the data portion of the tuple, not the descriptor. | |
944 | /* It is used when the receiving tuple is already allocated, | |
945 | /* with a correct descriptor, for sending just the data. | |
946 | /* | |
947 | /* Note that some of the routines for tuple_t could have been | |
948 | /* implemented in terms of tuple_data_t routines. For the | |
949 | /* moment, they have not been, but that may later be changed. | |
950 | /* Doesn't seem to make much difference as long as they are | |
951 | /* short and simple, and this way does save a bit of overhead. | |
952 | /* | |
953 | /************************************************************************/ | |
954 | ||
955 | #define TP_LEN (sizeof(TUPLE)) | |
956 | #define TP_ALI TP_LEN | |
957 | #define TP_NULL g_tp_null | |
958 | #define TP_CDLEN g_tp_cdlen | |
959 | #define TP_ENC g_tp_enc | |
960 | #define TP_DEC g_tp_dec | |
961 | #define TP_FORM g_tp_form | |
962 | #define TP_NAME "TUPLE_T" | |
963 | ||
964 | /*----------------------------------------------------------*/ | |
965 | /* | |
966 | /* g_tp_null | |
967 | /* | |
968 | /* Fill in a null value for a tuple. | |
969 | /* | |
970 | /*----------------------------------------------------------*/ | |
971 | int | |
972 | g_tp_null(dp) | |
973 | char *dp; /* pointer to the data */ | |
974 | { | |
975 | *((TUPLE *)dp) = NULL; | |
976 | } | |
977 | ||
978 | /*----------------------------------------------------------*/ | |
979 | /* | |
980 | /* g_tp_cdlen | |
981 | /* | |
982 | /* Return coded length for a tuple. We have to send the | |
983 | /* descriptor along with the data itself. We do this | |
984 | /* with calls to the appropriate encodeing routines. | |
985 | /* | |
986 | /*----------------------------------------------------------*/ | |
987 | ||
988 | int | |
989 | g_tp_cdlen(dp,hcon) | |
990 | char *dp; /* pointer to the data */ | |
991 | HALF_CONNECTION hcon; | |
992 | { | |
993 | register TUPLE tup = *((TUPLE *)dp); /* deref as tuple */ | |
994 | register int len; /* accumulated length */ | |
995 | register int i; /* index to fields */ | |
996 | TUPLE_DESCRIPTOR tpd; /* descriptor for this tuple */ | |
997 | ||
998 | /* | |
999 | * Validate the tuple | |
1000 | */ | |
1001 | if (tup == NULL) | |
1002 | GDB_GIVEUP("g_tp_cdlen (coded length) was given a null tuple\nthis may be due to an attempt to transmit invalid data") | |
1003 | GDB_CHECK_TUP(tup,"g_tp_cdlen: compute coded length of tuple") | |
1004 | ||
1005 | /* | |
1006 | * First, get length of the descriptor when coded. | |
1007 | */ | |
1008 | ||
1009 | tpd = DESCRIPTOR_FROM_TUPLE(tup); | |
1010 | len = g_tpd_cdlen((char *)&tpd,hcon); | |
1011 | ||
1012 | /* | |
1013 | * Now, for each field, add in its coded length | |
1014 | */ | |
1015 | ||
1016 | for (i=0; i<tpd->field_count; i++) { | |
1017 | len += (int)FCN_PROPERTY(FIELD_TYPE_IN_TUPLE(tpd,i), | |
1018 | CODED_LENGTH_PROPERTY) | |
1019 | (FIELD_FROM_TUPLE(tup, i),hcon); | |
1020 | } | |
1021 | ||
1022 | return len; | |
1023 | } | |
1024 | ||
1025 | /*----------------------------------------------------------*/ | |
1026 | /* | |
1027 | /* g_tp_enc | |
1028 | /* | |
1029 | /* Encode a tuple for transmission | |
1030 | /* | |
1031 | /*----------------------------------------------------------*/ | |
1032 | ||
d9f43d51 | 1033 | char * |
5580185e | 1034 | g_tp_enc(dp, hcon, outp) |
1035 | char *dp; /* pointer to data */ | |
1036 | HALF_CONNECTION hcon; /* connection descriptor */ | |
1037 | char *outp; /* place to put the output */ | |
1038 | { | |
1039 | register TUPLE tup = *((TUPLE *)dp); /* deref as tuple */ | |
1040 | register int i; /* index to fields */ | |
1041 | TUPLE_DESCRIPTOR tpd; /* descriptor for this tuple */ | |
1042 | char *op; /* next byte of output */ | |
1043 | ||
1044 | /* | |
1045 | * Validate the tuple | |
1046 | */ | |
1047 | if (tup == NULL) | |
1048 | GDB_GIVEUP("g_tp_enc (encode) was given a null tuple\nthis may be due to an attempt to transmit invalid data") | |
1049 | GDB_CHECK_TUP(tup,"g_tp_enc: encode tuple") | |
1050 | ||
1051 | /* | |
1052 | * First, get the tuple descriptor and encode it | |
1053 | */ | |
1054 | ||
1055 | tpd = DESCRIPTOR_FROM_TUPLE(tup); | |
1056 | op = (char *)g_tpd_enc((char *)&tpd, hcon, outp); | |
1057 | ||
1058 | /* | |
1059 | * Now, for each field, code it | |
1060 | */ | |
1061 | ||
1062 | for (i=0; i<tpd->field_count; i++) { | |
1063 | op = (char *)FCN_PROPERTY(FIELD_TYPE_IN_TUPLE(tpd,i), | |
1064 | ENCODE_PROPERTY) | |
1065 | (FIELD_FROM_TUPLE(tup, i),hcon, op); | |
1066 | } | |
1067 | ||
d9f43d51 | 1068 | return op; |
5580185e | 1069 | } |
1070 | ||
1071 | /*----------------------------------------------------------*/ | |
1072 | /* | |
1073 | /* g_tp_dec | |
1074 | /* | |
1075 | /* Decode a tuple from external form. For safety | |
1076 | /* in memory management, we always re-allocate the | |
1077 | /* space for the tuple, so the lengths come out right. | |
1078 | /* This may have nasty side effects if the intention | |
1079 | /* was to leave 'gas' at the end of the tuple, but | |
1080 | /* we want to accurately copy the data. Note that | |
1081 | /* tuple_free is robust against null pointers. | |
1082 | /* | |
1083 | /*----------------------------------------------------------*/ | |
1084 | ||
d9f43d51 | 1085 | char * |
5580185e | 1086 | g_tp_dec(outp, hcon, inp) |
1087 | char *inp; /* pointer to input data */ | |
1088 | HALF_CONNECTION hcon; /* connection descriptor */ | |
1089 | char *outp; /* place to put the output */ | |
1090 | { | |
1091 | register TUPLE tup; /* the new tuple */ | |
1092 | register int i; /* index to fields */ | |
1093 | TUPLE_DESCRIPTOR tpd; /* descriptor for this tuple */ | |
1094 | char *ip; /* next byte of input */ | |
1095 | ||
1096 | /* | |
1097 | * First, get the tuple descriptor and decode it | |
1098 | */ | |
1099 | ||
1100 | tpd = NULL; /* so decode will know */ | |
1101 | /* there's no existing one */ | |
1102 | /* to free */ | |
1103 | ip = (char *)g_tpd_dec((char *)&tpd, hcon, inp); | |
1104 | ||
1105 | /* | |
1106 | * Now make an empty tuple based on the descriptor | |
1107 | */ | |
1108 | ||
1109 | tup = create_tuple(tpd); | |
1110 | ||
1111 | /* | |
1112 | * The tuple descriptor has a reference count of 2 here, one | |
1113 | * from the tpd_dec routine, and one from the create_tuple. | |
1114 | * Since we don't expect to explicitly undo the two separately, | |
1115 | * we decrement the count here. | |
1116 | */ | |
1117 | ||
1118 | UNREFERENCE_TUPLE_DESCRIPTOR(tpd); /* decr. the reference count */ | |
1119 | ||
1120 | /* | |
1121 | * Now, for each field, decode it. | |
1122 | */ | |
1123 | ||
1124 | for (i=0; i<tpd->field_count; i++) { | |
1125 | ip = (char *)FCN_PROPERTY(FIELD_TYPE_IN_TUPLE(tpd,i), | |
1126 | DECODE_PROPERTY) | |
1127 | (FIELD_FROM_TUPLE(tup, i),hcon, ip); | |
1128 | } | |
1129 | ||
1130 | *((TUPLE *)outp) = tup; /* put the new tuple */ | |
1131 | /* pointer where the */ | |
1132 | /* caller wants it */ | |
d9f43d51 | 1133 | return ip; |
5580185e | 1134 | } |
1135 | ||
1136 | /*----------------------------------------------------------*/ | |
1137 | /* | |
1138 | /* g_tp_form | |
1139 | /* | |
1140 | /* Format a tuple on output logging file for | |
1141 | /* debugging. | |
1142 | /* | |
1143 | /*----------------------------------------------------------*/ | |
1144 | ||
1145 | int | |
1146 | g_tp_form(name, dp) | |
1147 | char *name; /* tuple name of the field */ | |
1148 | char *dp; /* pointer to the data */ | |
1149 | { | |
1150 | register TUPLE tup = *((TUPLE *)dp); /* deref as tuple */ | |
1151 | register int i; /* index to fields */ | |
1152 | TUPLE_DESCRIPTOR tpd; /* descriptor for this tuple */ | |
1153 | ||
1154 | ||
1155 | /* | |
1156 | * Handle special case where tuple is null | |
1157 | */ | |
1158 | ||
1159 | if (tup==NULL) { | |
1160 | fprintf(gdb_log,"\nTUPLE Name=%s is NULL\n---------------------------\n",name); | |
1161 | return; | |
1162 | } | |
1163 | ||
1164 | GDB_CHECK_TUP(tup,"g_tp_form: format tuple") | |
1165 | /* | |
1166 | * Get the descriptor--for now, we won't print it | |
1167 | */ | |
1168 | tpd = DESCRIPTOR_FROM_TUPLE(tup); | |
1169 | ||
1170 | /* | |
1171 | * Print a header | |
1172 | */ | |
1173 | ||
1174 | fprintf(gdb_log,"\nTUPLE at address: 0x%x Name=%s\n---------------------------\n",tup,name); | |
1175 | ||
1176 | /* | |
1177 | * Now, for each field, print it | |
1178 | */ | |
1179 | ||
1180 | for (i=0; i<tpd->field_count; i++) { | |
1181 | FCN_PROPERTY(FIELD_TYPE_IN_TUPLE(tpd,i), | |
1182 | FORMAT_PROPERTY) | |
1183 | (tpd->var[i].name,FIELD_FROM_TUPLE(tup, i)); | |
1184 | } | |
1185 | ||
1186 | fprintf(gdb_log,"END_OF_TUPLE\n"); | |
1187 | } | |
8fd777cf | 1188 | |
1189 | ||
5580185e | 1190 | /************************************************************************/ |
1191 | /* | |
1192 | /* TUPLE_DATA_T | |
1193 | /* | |
1194 | /* The distinction between tuple_data_t and tuple_t is a | |
1195 | /* subtle one. Tuple_t is used when a single tuple is to | |
1196 | /* be decoded, outside of any larger context. It (re)allocates | |
1197 | /* memory for both the tuple itself and its descriptor. | |
1198 | /* | |
1199 | /* Tuple_data is used in the case where the tuple and its | |
1200 | /* descriptor are already allocated, but only the data is | |
1201 | /* to be received. This is useful in cases like receiving an | |
1202 | /* entire relation, in which the descriptor is common to | |
1203 | /* all the tuples, and should not be resent or reallocated | |
1204 | /* with each one. Receive relation can send the tuple descriptor | |
1205 | /* once, then do a create_tuple followed by a decode tuple_data | |
1206 | /* to receive the tuple field data into the existing tuple. | |
1207 | /* | |
1208 | /* Note that the definition of null is different in the two cases. | |
1209 | /* The null value for a tuple is just a null pointer. The null | |
1210 | /* for tuple data is to null each of the fields in the tuple | |
1211 | /* recursively. The routines in this section may dereference | |
1212 | /* null pointers if the tuples they are passed are null. Note | |
1213 | /* also that there is one less level of indirection in passing | |
1214 | /* data to these routines than to those of tuple_t. | |
1215 | /* | |
1216 | /* Note also that the null and decode routines supplied here | |
1217 | /* presume that any fields with dependent memory (e.g. string_t | |
1218 | /* fields have already been cleaned up.) | |
1219 | /* | |
1220 | /* Note that this is not quite a kosher type, in the sense that | |
1221 | /* it's length is not fixed. The entry for length below | |
1222 | /* is meaningless, because the real length is computed from the | |
1223 | /* desc. Among other things, this means that TUPLEs cannot | |
1224 | /* contain fields of this type. | |
1225 | /* | |
1226 | /************************************************************************/ | |
1227 | ||
1228 | #define TDT_LEN (sizeof(TUPLE)) | |
1229 | #define TDT_ALI TDT_LEN | |
1230 | #define TDT_NULL g_tdt_null | |
1231 | #define TDT_CDLEN g_tdt_cdlen | |
1232 | #define TDT_ENC g_tdt_enc | |
1233 | #define TDT_DEC g_tdt_dec | |
1234 | #define TDT_FORM g_tdt_form | |
1235 | #define TDT_NAME "TUPLE_DATA_T" | |
1236 | ||
1237 | /*----------------------------------------------------------*/ | |
1238 | /* | |
1239 | /* g_tdt_null | |
1240 | /* | |
1241 | /* Fill in a null value for a tuple. | |
1242 | /* | |
1243 | /*----------------------------------------------------------*/ | |
1244 | int | |
1245 | g_tdt_null(dp) | |
1246 | char *dp; /* pointer to the data */ | |
1247 | { | |
1248 | TUPLE tup = (TUPLE)dp; /* dp is of type TUPLE, */ | |
1249 | /* which is actually */ | |
1250 | /* a pointer to the */ | |
1251 | /* tuple data */ | |
1252 | TUPLE_DESCRIPTOR tpd; /* the descriptor for this */ | |
1253 | /* tuple*/ | |
1254 | register int i; /* a loop counter */ | |
1255 | ||
1256 | /* | |
1257 | * For each field in the tuple, call its null routine | |
1258 | */ | |
1259 | tup->id = GDB_TUP_ID; | |
1260 | ||
1261 | tpd = DESCRIPTOR_FROM_TUPLE(tup); | |
1262 | ||
1263 | for (i=0; i<tpd->field_count; i++) { | |
1264 | FCN_PROPERTY(FIELD_TYPE_IN_TUPLE(tpd,i),NULL_PROPERTY) | |
1265 | (FIELD_FROM_TUPLE(tup,i)); | |
1266 | } | |
1267 | } | |
1268 | ||
1269 | /*----------------------------------------------------------*/ | |
1270 | /* | |
1271 | /* g_tdt_cdlen | |
1272 | /* | |
1273 | /* Return coded length for tuple data. Since the descriptor | |
1274 | /* for the tuple is known at both sides, we send only | |
1275 | /* the coded fields, not even the field counts. | |
1276 | /* | |
1277 | /*----------------------------------------------------------*/ | |
1278 | ||
1279 | int | |
1280 | g_tdt_cdlen(dp,hcon) | |
1281 | char *dp; /* pointer to the data */ | |
1282 | HALF_CONNECTION hcon; | |
1283 | { | |
1284 | register TUPLE tup = (TUPLE)dp; /* arg typed as tuple */ | |
1285 | register int len; /* accumulated length */ | |
1286 | register int i; /* index to fields */ | |
1287 | TUPLE_DESCRIPTOR tpd; /* descriptor for this tuple */ | |
1288 | ||
1289 | /* | |
1290 | * Validate the tuple data | |
1291 | */ | |
1292 | if (tup == NULL) | |
1293 | GDB_GIVEUP("g_tdt_cdlen (coded length) was given null tuple data\nthis may be due to an attempt to transmit invalid data") | |
1294 | GDB_CHECK_TUP(tup,"g_tdt_cdlen: compute coded length of tuple data") | |
1295 | /* | |
1296 | * First, find the tuple descriptor and set initial coded len to 0 | |
1297 | */ | |
1298 | ||
1299 | tpd = DESCRIPTOR_FROM_TUPLE(tup); | |
1300 | len = 0; | |
1301 | ||
1302 | /* | |
1303 | * Now, for each field, add in its coded length | |
1304 | */ | |
1305 | ||
1306 | for (i=0; i<tpd->field_count; i++) { | |
1307 | len += (int)FCN_PROPERTY(FIELD_TYPE_IN_TUPLE(tpd,i), | |
1308 | CODED_LENGTH_PROPERTY) | |
1309 | (FIELD_FROM_TUPLE(tup, i),hcon); | |
1310 | } | |
1311 | ||
1312 | return len; | |
1313 | } | |
1314 | ||
1315 | /*----------------------------------------------------------*/ | |
1316 | /* | |
1317 | /* g_tdt_enc | |
1318 | /* | |
1319 | /* Encode tuple data for transmission. | |
1320 | /* | |
1321 | /*----------------------------------------------------------*/ | |
1322 | ||
d9f43d51 | 1323 | char * |
5580185e | 1324 | g_tdt_enc(dp, hcon, outp) |
1325 | char *dp; /* pointer to data */ | |
1326 | HALF_CONNECTION hcon; /* connection descriptor */ | |
1327 | char *outp; /* place to put the output */ | |
1328 | { | |
1329 | register TUPLE tup = (TUPLE)dp; /* type as tuple */ | |
1330 | register int i; /* index to fields */ | |
1331 | TUPLE_DESCRIPTOR tpd; /* descriptor for this tuple */ | |
1332 | char *op = outp; /* next byte of output */ | |
1333 | ||
1334 | /* | |
1335 | * Validate the tuple data | |
1336 | */ | |
1337 | if (tup == NULL) | |
1338 | GDB_GIVEUP("g_tdt_enc (encode) was given null tuple data\nthis may be due to an attempt to transmit invalid data") | |
1339 | GDB_CHECK_TUP(tup,"g_tdt_enc: encode of tuple data") | |
1340 | /* | |
1341 | * First, get the tuple descriptor | |
1342 | */ | |
1343 | ||
1344 | tpd = DESCRIPTOR_FROM_TUPLE(tup); | |
1345 | ||
1346 | /* | |
1347 | * Now, for each field, code it | |
1348 | */ | |
1349 | ||
1350 | for (i=0; i<tpd->field_count; i++) { | |
1351 | op = (char *)FCN_PROPERTY(FIELD_TYPE_IN_TUPLE(tpd,i), | |
1352 | ENCODE_PROPERTY) | |
1353 | (FIELD_FROM_TUPLE(tup, i),hcon, op); | |
1354 | } | |
1355 | ||
d9f43d51 | 1356 | return op; |
5580185e | 1357 | } |
1358 | ||
1359 | /*----------------------------------------------------------*/ | |
1360 | /* | |
1361 | /* g_tdt_dec | |
1362 | /* | |
1363 | /* Decode tuple data from external form. We presume | |
1364 | /* that the tuple itself is allocated, and the descriptor | |
1365 | /* properly set up for the local machine representation. | |
1366 | /* Here we just decode the fields. | |
1367 | /* | |
1368 | /*----------------------------------------------------------*/ | |
1369 | ||
d9f43d51 | 1370 | char * |
5580185e | 1371 | g_tdt_dec(outp, hcon, inp) |
1372 | char *inp; /* pointer to input data */ | |
1373 | HALF_CONNECTION hcon; /* connection descriptor */ | |
1374 | char *outp; /* place to put the output */ | |
1375 | { | |
1376 | register TUPLE tup = (TUPLE)outp; /* the filled in tuple */ | |
1377 | register int i; /* index to fields */ | |
1378 | TUPLE_DESCRIPTOR tpd; /* descriptor for this tuple */ | |
1379 | char *ip = inp; /* next byte of input */ | |
1380 | ||
1381 | /* | |
1382 | * Validate the tuple data | |
1383 | */ | |
1384 | if (tup == NULL) | |
1385 | GDB_GIVEUP("g_tdt_dec (decode) was given null tuple data\nthis may be due to an attempt to transmit invalid data") | |
1386 | GDB_CHECK_TUP(tup,"g_tdt_dec: decode of tuple data") | |
1387 | /* | |
1388 | * First, get the tuple descriptor | |
1389 | */ | |
1390 | ||
1391 | tpd = DESCRIPTOR_FROM_TUPLE(tup); | |
1392 | ||
1393 | /* | |
1394 | * Now, for each field, decode it. | |
1395 | */ | |
1396 | ||
1397 | for (i=0; i<tpd->field_count; i++) { | |
1398 | ip = (char *)FCN_PROPERTY(FIELD_TYPE_IN_TUPLE(tpd,i), | |
1399 | DECODE_PROPERTY) | |
1400 | (FIELD_FROM_TUPLE(tup, i),hcon, ip); | |
1401 | } | |
1402 | ||
d9f43d51 | 1403 | return ip; |
5580185e | 1404 | } |
1405 | ||
1406 | /*----------------------------------------------------------*/ | |
1407 | /* | |
1408 | /* g_tdt_form | |
1409 | /* | |
1410 | /* Format tuple data on output logging file for | |
1411 | /* debugging. | |
1412 | /* | |
1413 | /*----------------------------------------------------------*/ | |
1414 | ||
1415 | int | |
1416 | g_tdt_form(name, dp) | |
1417 | char *name; /* tuple name of the field */ | |
1418 | char *dp; /* pointer to the data */ | |
1419 | { | |
1420 | register TUPLE tup = (TUPLE)dp; /* as tuple */ | |
1421 | register int i; /* index to fields */ | |
1422 | TUPLE_DESCRIPTOR tpd; /* descriptor for this tuple */ | |
1423 | ||
1424 | ||
1425 | /* | |
1426 | * Handle special case where we're given a null address for the | |
1427 | * tuple | |
1428 | */ | |
1429 | if (tup==NULL) { | |
1430 | fprintf(gdb_log,"\nTUPLE Name=%s is NULL\n---------------------------\n",name); | |
1431 | return; | |
1432 | } | |
1433 | ||
1434 | ||
1435 | /* | |
1436 | * Validate the tuple data | |
1437 | */ | |
1438 | GDB_CHECK_TUP(tup,"g_tdt_form: format tuple data") | |
1439 | /* | |
1440 | * Get the descriptor--for now, we won't print it | |
1441 | */ | |
1442 | tpd = DESCRIPTOR_FROM_TUPLE(tup); | |
1443 | ||
1444 | /* | |
1445 | * Print a header | |
1446 | */ | |
1447 | ||
1448 | fprintf(gdb_log,"\nTUPLE at address: 0x%x Name=%s\n---------------------------\n",tup,name); | |
1449 | ||
1450 | /* | |
1451 | * Now, for each field, print it | |
1452 | */ | |
1453 | ||
1454 | for (i=0; i<tpd->field_count; i++) { | |
1455 | FCN_PROPERTY(FIELD_TYPE_IN_TUPLE(tpd,i), | |
1456 | FORMAT_PROPERTY) | |
1457 | (tpd->var[i].name,FIELD_FROM_TUPLE(tup, i)); | |
1458 | } | |
1459 | ||
1460 | fprintf(gdb_log,"END_OF_TUPLE\n"); | |
1461 | } | |
8fd777cf | 1462 | |
1463 | ||
5580185e | 1464 | /************************************************************************/ |
1465 | /* | |
1466 | /* RELATION_T | |
1467 | /* | |
1468 | /* Relations consist of link lists of tuples, all of which are | |
1469 | /* presumed to share a tuple descriptor. For transmission, | |
1470 | /* these are encoded as follows: | |
1471 | /* | |
1472 | /* 1) A count of the number of tuples, sent as a properly coded | |
1473 | /* integer. | |
1474 | /* | |
1475 | /* 2) The tuple descriptor itself, encoded by its encoding routine. | |
1476 | /* | |
1477 | /* 3) For each tuple, its tuple data, encoded using the routines | |
1478 | /* of the tuple_data_t type. | |
1479 | /* | |
1480 | /************************************************************************/ | |
1481 | ||
1482 | #define REL_LEN (sizeof(RELATION)) | |
1483 | #define REL_ALI REL_LEN | |
1484 | #define REL_NULL g_rel_null | |
1485 | #define REL_CDLEN g_rel_cdlen | |
1486 | #define REL_ENC g_rel_enc | |
1487 | #define REL_DEC g_rel_dec | |
1488 | #define REL_FORM g_rel_form | |
1489 | #define REL_NAME "RELATION_T" | |
1490 | ||
1491 | ||
1492 | /*----------------------------------------------------------*/ | |
1493 | /* | |
1494 | /* g_rel_null | |
1495 | /* | |
1496 | /* Fill in a null value for a relation. Maybe we should | |
1497 | /* check for an existing relation and properly free it, | |
1498 | /* but for now, we don't. | |
1499 | /* | |
1500 | /*----------------------------------------------------------*/ | |
1501 | int | |
1502 | g_rel_null(dp) | |
1503 | char *dp; /* pointer to the data */ | |
1504 | { | |
1505 | *((RELATION *)dp) = NULL; | |
1506 | } | |
1507 | ||
1508 | /*----------------------------------------------------------*/ | |
1509 | /* | |
1510 | /* g_rel_cdlen | |
1511 | /* | |
1512 | /* Return coded length for a relation. | |
1513 | /* | |
1514 | /*----------------------------------------------------------*/ | |
1515 | ||
1516 | int | |
1517 | g_rel_cdlen(dp,hcon) | |
1518 | char *dp; /* pointer to the data */ | |
1519 | HALF_CONNECTION hcon; | |
1520 | { | |
1521 | register RELATION rel = *((RELATION *)dp); /* deref as relation */ | |
1522 | int len; /* accumulated length */ | |
1523 | register TUPLE t; /* index to a tuple */ | |
1524 | int tuple_count = 0; /* number of tuples in this */ | |
1525 | /* relation*/ | |
1526 | TUPLE_DESCRIPTOR tpd; /* descriptor for this */ | |
1527 | /* relation */ | |
1528 | ||
1529 | /* | |
1530 | * Validate the relation | |
1531 | */ | |
1532 | if (rel == NULL) | |
1533 | GDB_GIVEUP("g_rel_cdlen (coded length) was given null relation\nthis may be due to an attempt to transmit invalid data") | |
1534 | GDB_CHECK_REL(rel,"g_rel_cdlen: compute coded length of relation") | |
1535 | /* | |
1536 | * First, get the tuple descriptor for this relation | |
1537 | */ | |
1538 | ||
1539 | tpd = DESCRIPTOR_FROM_RELATION(rel); | |
1540 | ||
1541 | /* | |
1542 | * Count the number of tuples in the relation | |
1543 | */ | |
1544 | for (t=FIRST_TUPLE_IN_RELATION(rel); t != NULL; | |
1545 | t = NEXT_TUPLE_IN_RELATION(rel,t)) | |
1546 | tuple_count++; | |
1547 | /* | |
1548 | * Start with the coded length for the tuple count and the | |
1549 | * descriptor, which are sent first. | |
1550 | */ | |
1551 | ||
1552 | len = g_in_cdlen((char *)&tuple_count, hcon); /* length of tuple_count */ | |
1553 | /* in coded form */ | |
1554 | len += g_tpd_cdlen((char *)&tpd, hcon); | |
1555 | ||
1556 | /* | |
1557 | * Now, for each tuple, add in its coded length | |
1558 | */ | |
1559 | ||
1560 | for (t=FIRST_TUPLE_IN_RELATION(rel); t != NULL; | |
1561 | t = NEXT_TUPLE_IN_RELATION(rel,t)) | |
1562 | len += g_tdt_cdlen((char *)t, hcon); | |
1563 | ||
1564 | return len; | |
1565 | } | |
1566 | ||
1567 | /*----------------------------------------------------------*/ | |
1568 | /* | |
1569 | /* g_rel_enc | |
1570 | /* | |
1571 | /* Encode a relation for transmission | |
1572 | /* | |
1573 | /*----------------------------------------------------------*/ | |
1574 | ||
d9f43d51 | 1575 | char * |
5580185e | 1576 | g_rel_enc(dp, hcon, outp) |
1577 | char *dp; /* pointer to data */ | |
1578 | HALF_CONNECTION hcon; /* connection descriptor */ | |
1579 | char *outp; /* place to put the output */ | |
1580 | { | |
1581 | register RELATION rel = *((RELATION *)dp); /* deref as relation */ | |
1582 | char *op; /* pointer to next unused */ | |
1583 | /* output byte*/ | |
1584 | register TUPLE t; /* index to a tuple */ | |
1585 | int tuple_count = 0; /* number of tuples in this */ | |
1586 | /* relation*/ | |
1587 | TUPLE_DESCRIPTOR tpd; /* descriptor for this */ | |
1588 | /* relation */ | |
1589 | ||
1590 | /* | |
1591 | * Validate the relation | |
1592 | */ | |
1593 | if (rel == NULL) | |
1594 | GDB_GIVEUP("g_rel_enc (encode) was given null relation\nthis may be due to an attempt to transmit invalid data") | |
1595 | GDB_CHECK_REL(rel,"g_rel_enc: encode relation") | |
1596 | ||
1597 | /* | |
1598 | * First, get the tuple descriptor for this relation | |
1599 | */ | |
1600 | ||
1601 | tpd = DESCRIPTOR_FROM_RELATION(rel); | |
1602 | ||
1603 | /* | |
1604 | * Count the number of tuples in the relation | |
1605 | */ | |
1606 | for (t=FIRST_TUPLE_IN_RELATION(rel); t != NULL; | |
1607 | t = NEXT_TUPLE_IN_RELATION(rel,t)) | |
1608 | tuple_count++; | |
1609 | /* | |
1610 | * Encode the count and the tuple descriptor for this relation | |
1611 | */ | |
1612 | ||
1613 | op = (char *)g_in_enc((char *)&tuple_count, hcon,outp); | |
1614 | /* length of tuple_count */ | |
1615 | /* in coded form */ | |
1616 | op = (char *)g_tpd_enc((char *)&tpd, hcon,op); | |
1617 | ||
1618 | /* | |
1619 | * Now, encode each tuple | |
1620 | */ | |
1621 | ||
1622 | for (t=FIRST_TUPLE_IN_RELATION(rel); t != NULL; | |
1623 | t = NEXT_TUPLE_IN_RELATION(rel,t)) | |
1624 | op = (char *)g_tdt_enc((char *)t, hcon, op); | |
1625 | ||
d9f43d51 | 1626 | return op; |
5580185e | 1627 | } |
1628 | ||
1629 | /*----------------------------------------------------------*/ | |
1630 | /* | |
1631 | /* g_rel_dec | |
1632 | /* | |
1633 | /* Decode a relation from external form. We should | |
1634 | /* really check to make sure the relation we are given | |
1635 | /* is null, and if not, call delete_relation on it | |
1636 | /* first. For the moment, we just presume it's null. | |
1637 | /* | |
1638 | /* We proceed by decoding the integer count and the | |
1639 | /* tuple descriptor, from which we create the null | |
1640 | /* relation. We then loop for each tuple, doing a | |
1641 | /* create, a decode, and an add to relation. | |
1642 | /* | |
1643 | /*----------------------------------------------------------*/ | |
1644 | ||
d9f43d51 | 1645 | char * |
5580185e | 1646 | g_rel_dec(outp, hcon, inp) |
1647 | char *inp; /* pointer to input data */ | |
1648 | HALF_CONNECTION hcon; /* connection descriptor */ | |
1649 | char *outp; /* place to put the output */ | |
1650 | { | |
1651 | register RELATION rel; /* build the relation here */ | |
1652 | char *ip; /* pointer to next unused */ | |
1653 | /* input byte*/ | |
1654 | register TUPLE t; /* index to a tuple */ | |
1655 | register int i; /* loop counter on tuples */ | |
1656 | int tuple_count = 0; /* number of tuples in this */ | |
1657 | /* relation*/ | |
1658 | TUPLE_DESCRIPTOR tpd; /* descriptor for this */ | |
1659 | /* relation */ | |
1660 | ||
1661 | /* | |
1662 | * First, get the field count and tuple descriptor for this relation | |
1663 | */ | |
1664 | ||
1665 | ip = (char *)g_in_dec((char *)&tuple_count, hcon, inp); | |
1666 | ||
1667 | tpd = NULL; /* so decode will know */ | |
1668 | /* there's no existing one */ | |
1669 | /* to free */ | |
1670 | ip = (char *)g_tpd_dec((char *)&tpd, hcon, ip); | |
1671 | ||
1672 | /* | |
1673 | * Now, create a null relation using the descriptor | |
1674 | */ | |
1675 | ||
1676 | rel = create_relation(tpd); | |
1677 | ||
1678 | /* | |
1679 | * The reference count for the tuple descriptor is currently 2, | |
1680 | * one from the tpd_dec and one from the create relation. Since | |
1681 | * these will not be undone separately, we decrement the reference | |
1682 | * count to 1 | |
1683 | */ | |
1684 | ||
1685 | UNREFERENCE_TUPLE_DESCRIPTOR(tpd); | |
1686 | ||
1687 | /* | |
1688 | * For each tuple, create it, receive it, add it to the relation | |
1689 | */ | |
1690 | ||
1691 | for (i=0; i<tuple_count; i++) { | |
1692 | t = create_tuple(tpd); | |
1693 | ip = (char *)g_tdt_dec((char *)t, hcon, ip); | |
1694 | ADD_TUPLE_TO_RELATION(rel, t); | |
1695 | } | |
1696 | ||
1697 | /* | |
1698 | * Now store the address of the created relation where requested | |
1699 | * and return pointer to next available input byte. | |
1700 | */ | |
1701 | ||
1702 | *((RELATION *)outp) = rel; | |
1703 | ||
d9f43d51 | 1704 | return ip; |
5580185e | 1705 | } |
1706 | ||
1707 | /*----------------------------------------------------------*/ | |
1708 | /* | |
1709 | /* g_rel_form | |
1710 | /* | |
1711 | /* Format a relation on output logging file for | |
1712 | /* debugging. | |
1713 | /* | |
1714 | /*----------------------------------------------------------*/ | |
1715 | ||
1716 | int | |
1717 | g_rel_form(name, dp) | |
1718 | char *name; /* relation name of the field */ | |
1719 | char *dp; /* pointer to the data */ | |
1720 | { | |
1721 | register RELATION rel = *((RELATION *)dp); /* deref as relation */ | |
1722 | register TUPLE t; | |
1723 | int count =0; | |
1724 | char buffer[50]; | |
1725 | ||
1726 | /* | |
1727 | * Handle special case where relation is null | |
1728 | */ | |
1729 | ||
1730 | if (rel == NULL) { | |
1731 | fprintf(gdb_log,"\nRELATION Name=%s is NULL\n===========================\n",name); | |
1732 | return; | |
1733 | } | |
1734 | ||
1735 | GDB_CHECK_REL(rel,"g_rel_form: format relation") | |
1736 | ||
1737 | /* | |
1738 | * Print a header | |
1739 | */ | |
1740 | ||
1741 | fprintf(gdb_log,"\nRELATION at address: 0x%x Name=%s\n===========================\n",rel,name); | |
1742 | ||
1743 | /* | |
1744 | * Now, for each field, print it | |
1745 | */ | |
1746 | ||
1747 | for (t=FIRST_TUPLE_IN_RELATION(rel); t != NULL; | |
1748 | t = NEXT_TUPLE_IN_RELATION(rel,t)){ | |
1749 | (void) sprintf(buffer,"Number %d",++count); | |
1750 | g_tdt_form(buffer,(char *)t); | |
1751 | } | |
1752 | ||
1753 | fprintf(gdb_log,"END_OF_RELATION\n"); | |
1754 | } | |
8fd777cf | 1755 | |
1756 | ||
5580185e | 1757 | /************************************************************************/ |
1758 | /* | |
1759 | /* DECLARE AND INITIALIZE THE SYSTEM TYPE DEFINITION | |
1760 | /* TABLES | |
1761 | /* | |
1762 | /* This representation is clearly a real pain to keep up to date | |
1763 | /* properly, mostly because C has such a lousy pre-processor. | |
1764 | /* Probably this should be re-arranged so an initialization routine | |
1765 | /* is called to set up the tables, but even that might be a nuissance. | |
1766 | /* | |
1767 | /************************************************************************/ | |
1768 | ||
1769 | /*----------------------------------------------------------*/ | |
1770 | /* | |
1771 | /* gdb_i_stype | |
1772 | /* | |
1773 | /* Called at startup to initialize the type table with | |
1774 | /* the entries for the system types. | |
1775 | /* | |
1776 | /*----------------------------------------------------------*/ | |
1777 | ||
1778 | #define ITYPE(inx,lp,ap,np,clp,ep,dp,fp,name) {\ | |
1779 | g_type_table[inx][LENGTH_PROPERTY].i = lp; \ | |
1780 | g_type_table[inx][ALIGNMENT_PROPERTY].i = ap; \ | |
1781 | g_type_table[inx][NULL_PROPERTY].f = np; \ | |
1782 | g_type_table[inx][CODED_LENGTH_PROPERTY].f = clp; \ | |
d9f43d51 | 1783 | g_type_table[inx][ENCODE_PROPERTY].cpf = ep; \ |
1784 | g_type_table[inx][DECODE_PROPERTY].cpf = dp; \ | |
5580185e | 1785 | g_type_table[inx][FORMAT_PROPERTY].f = fp; \ |
1786 | g_type_table[inx][NAME_PROPERTY].cp = name; \ | |
1787 | } | |
1788 | ||
1789 | int | |
1790 | gdb_i_stype() | |
1791 | { | |
1792 | gdb_n_types = SYSTEM_TYPE_COUNT; | |
1793 | ||
1794 | ITYPE(INTEGER_T,IN_LEN,IN_ALI,IN_NULL,IN_CDLEN,IN_ENC,IN_DEC,IN_FORM, | |
1795 | IN_NAME) | |
1796 | ITYPE(STRING_T,ST_LEN,ST_ALI,ST_NULL,ST_CDLEN,ST_ENC,ST_DEC,ST_FORM, | |
1797 | ST_NAME) | |
1798 | ITYPE(REAL_T,RL_LEN,RL_ALI,RL_NULL,RL_CDLEN,RL_ENC,RL_DEC,RL_FORM, | |
1799 | RL_NAME) | |
1800 | ITYPE(DATE_T,DT_LEN,DT_ALI,DT_NULL,DT_CDLEN,DT_ENC,DT_DEC,DT_FORM, | |
1801 | DT_NAME) | |
1802 | ITYPE(TUPLE_DESCRIPTOR_T,TPD_LEN,TPD_ALI,TPD_NULL,TPD_CDLEN,TPD_ENC, | |
1803 | TPD_DEC,TPD_FORM,TPD_NAME) | |
1804 | ITYPE(TUPLE_T,TP_LEN,TP_ALI,TP_NULL,TP_CDLEN,TP_ENC,TP_DEC,TP_FORM, | |
1805 | TP_NAME) | |
1806 | ITYPE(TUPLE_DATA_T,TDT_LEN,TDT_ALI,TDT_NULL,TDT_CDLEN,TDT_ENC,TDT_DEC, | |
1807 | TDT_FORM,TDT_NAME) | |
1808 | ITYPE(RELATION_T,REL_LEN,REL_ALI,REL_NULL,REL_CDLEN,REL_ENC,REL_DEC, | |
1809 | REL_FORM,REL_NAME) | |
1810 | } |