#ifndef lint
static char *rcsid_gdb_stype_c = "$Header$";
-#endif lint
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-/************************************************************************/
-/*
-/* gdb_stype.c
-/*
-/* GDB - System Data Type Definitions
-/*
-/* Author: Noah Mendelsohn
-/* Copyright: 1986 MIT Project Athena
-/* For copying and distribution information, please see
-/* the file <mit-copyright.h>.
-/*
-/* This file initializes the definitions for all system defined
-/* data types, and it includes the type specific semantic routines
-/* for each of the system defined types.
-/*
-/* The initialization routine which adds these type definitions
-/* to the type definition table is at the end of this source file.
-/*
-/************************************************************************/
-/*
-/* This file is organized into one section for each system
-/* defined type followed at the end by a final section which
-/* initializes the type tables. Each of the type specific
-/* sections does #defines for each type specific parameter. The
-/* gdb_i_stype initialization routine at the end of this source
-/* file uses these defines to initialize the appropriate entry in
-/* the type definition tables.
-/*
-/* NOTE: some of the type definitions in this file may be machine
-/* dependent.
-/*
-/************************************************************************/
+#endif
+
+
+/************************************************************************
+ *
+ * gdb_stype.c
+ *
+ * GDB - System Data Type Definitions
+ *
+ * Author: Noah Mendelsohn
+ * Copyright: 1986 MIT Project Athena
+ * For copying and distribution information, please see
+ * the file <mit-copyright.h>.
+ *
+ * This file initializes the definitions for all system defined
+ * data types, and it includes the type specific semantic routines
+ * for each of the system defined types.
+ *
+ * The initialization routine which adds these type definitions
+ * to the type definition table is at the end of this source file.
+ *
+ ************************************************************************
+ *
+ * This file is organized into one section for each system
+ * defined type followed at the end by a final section which
+ * initializes the type tables. Each of the type specific
+ * sections does #defines for each type specific parameter. The
+ * gdb_i_stype initialization routine at the end of this source
+ * file uses these defines to initialize the appropriate entry in
+ * the type definition tables.
+ *
+ * NOTE: some of the type definitions in this file may be machine
+ * dependent.
+ *
+ ************************************************************************/
#include <mit-copyright.h>
#include <stdio.h>
-#include <strings.h>
+#include <string.h>
#include "gdb.h"
-#ifdef vax /* XXX */
- extern u_long ntohl(), htonl();
-#endif vax
#include <netinet/in.h> /* for htonl routine */
-\f
-/************************************************************************/
-/*
-/* INTEGER_T
-/*
-/************************************************************************/
+
+
+/************************************************************************
+ *
+ * INTEGER_T
+ *
+ ************************************************************************/
#define IN_LEN (sizeof(int))
#define IN_ALI IN_LEN
/*----------------------------------------------------------*/
+/*ARGSUSED*/
int
g_in_cdlen(dp,hcon)
char *dp; /* pointer to the data */
/*
/*----------------------------------------------------------*/
-int
+/*ARGSUSED*/
+char *
g_in_enc(dp, hcon, outp)
char *dp; /* pointer to data */
HALF_CONNECTION hcon; /* connection descriptor */
register char *op = outp;
register char *endp = outp+IN_EXTERNSIZE;
- unsigned long converted; /* the integer goes here */
+ uint32 converted; /* the integer goes here */
/* in network byte order*/
/*
* account for the fact that the RT has trouble with unaligned longs
*/
- converted = htonl(*(u_long *)dp);
+ converted = htonl(*(uint32 *)dp);
cp = (char *)&converted;
*op++ = *cp++;
*op++ = *cp++;
*op++ = *cp++;
- return (int)(endp); /* return pointer to next */
+ return endp; /* return pointer to next */
/* unused output byte*/
}
/*
/*----------------------------------------------------------*/
-int
+/*ARGSUSED*/
+char *
g_in_dec(outp, hcon, inp)
char *inp; /* pointer to data */
HALF_CONNECTION hcon; /* connection descriptor */
*/
*(int *)outp = ntohl((u_long)buffer);
- return (int)(ip);
+ return ip;
}
/*----------------------------------------------------------*/
{
fprintf(gdb_log, "INTEGER_T\t%s=%d\n",name,(*(int *)dp));
}
-\f
+
+
/************************************************************************/
/*
/* STRING_T
/************************************************************************/
#define ST_LEN (sizeof(STRING))
-#define ST_ALI (sizeof(int))
+#define ST_ALI (sizeof(char *))
#define ST_NULL g_st_null
#define ST_CDLEN g_st_cdlen
#define ST_ENC g_st_enc
/*
/*----------------------------------------------------------*/
-int
+char *
g_st_enc(dp, hcon, outp)
char *dp; /* pointer to data */
HALF_CONNECTION hcon; /* connection descriptor */
* Now, copy the data itself after the encoded integer length
*/
if (len > 0)
- bcopy(STRING_DATA(*stp), nextp, len);
+ memcpy(nextp, STRING_DATA(*stp), len);
/* copy the data without */
/* changing representation*/
- return (int)(nextp+len);
+ return nextp+len;
}
/*----------------------------------------------------------*/
/*
/*----------------------------------------------------------*/
-int
+char *
g_st_dec(outp, hcon, inp)
char *inp; /* pointer to input data */
HALF_CONNECTION hcon; /* connection descriptor */
if (len == 0) {
STRING_DATA(*stp) = NULL;
MAX_STRING_SIZE(*stp) = 0;
- return (int)(nextp);
+ return nextp;
}
(void) string_alloc(stp, len); /* this sets string length */
/* in addition to doing the */
/*
* Now, copy the data itself
*/
- bcopy(nextp, STRING_DATA(*stp), len); /* copy the data without */
+ memcpy(STRING_DATA(*stp), nextp, len); /* copy the data without */
/* changing representation*/
- return (int)(nextp+len);
+ return nextp+len;
}
/*----------------------------------------------------------*/
fprintf(gdb_log,"\"\n");
}
-\f
+
+
/************************************************************************/
/*
/* REAL_T
/*----------------------------------------------------------*/
+/*ARGSUSED*/
int
g_rl_cdlen(dp,hcon)
char *dp; /* pointer to the data */
/*
/*----------------------------------------------------------*/
-int
+/*ARGSUSED*/
+char *
g_rl_enc(dp, hcon, outp)
char *dp; /* pointer to data */
HALF_CONNECTION hcon; /* connection descriptor */
while (cp < endp)
*cp++ = ' '; /* pad to desired length */
- return (int)(outp+RL_EXTERNSIZE); /* return pointer to next */
+ return outp+RL_EXTERNSIZE; /* return pointer to next */
/* unused output byte*/
}
/*
/*----------------------------------------------------------*/
-int
+/*ARGSUSED*/
+char *
g_rl_dec(outp, hcon, inp)
char *inp; /* pointer to data */
HALF_CONNECTION hcon; /* connection descriptor */
char *outp; /* place to put the output */
{
(void) sscanf(inp,"%30le", (double *)outp);
- return (int)(inp+RL_EXTERNSIZE);
+ return inp+RL_EXTERNSIZE;
}
/*----------------------------------------------------------*/
{
fprintf(gdb_log, "REAL_T\t\t%s=%le\n",name,*((double *)dp) );
}
-\f
+
+
/************************************************************************/
/*
/* DATE_T
/*----------------------------------------------------------*/
+/*ARGSUSED*/
int
g_dt_cdlen(dp,hcon)
char *dp; /* pointer to the data */
/*
/*----------------------------------------------------------*/
-int
+/*ARGSUSED*/
+char *
g_dt_enc(dp, hcon, outp)
char *dp; /* pointer to data */
HALF_CONNECTION hcon; /* connection descriptor */
while (op < endp)
*op++ = *ip++; /* pad to desired length */
- return (int)(endp); /* return pointer to next */
+ return endp; /* return pointer to next */
/* unused output byte*/
}
/*
/*----------------------------------------------------------*/
-int
+/*ARGSUSED*/
+char *
g_dt_dec(outp, hcon, inp)
char *inp; /* pointer to data */
HALF_CONNECTION hcon; /* connection descriptor */
while (op < endp)
*op++ = *ip++; /* pad to desired length */
- return (int)(endp); /* return pointer to next */
+ return endp; /* return pointer to next */
/* unused output byte*/
}
{
char buf[DT_EXTERNSIZE+1];
- bcopy(dp, buf, DT_EXTERNSIZE); /* copy date to buffer */
+ memcpy(buf, dp, DT_EXTERNSIZE); /* copy date to buffer */
buf[DT_EXTERNSIZE] = '\0'; /* null terminate it */
fprintf(gdb_log, "DATE_T\t\t%s=%s\n",name,buf);
}
-\f
+
+
/************************************************************************/
/*
/* TUPLE_DESCRIPTOR_T
/*
/*----------------------------------------------------------*/
-int
+char *
g_tpd_enc(dp, hcon, outp)
char *dp; /* pointer to data */
HALF_CONNECTION hcon; /* connection descriptor */
/*
* Finally, copy all the null terminated strings.
*/
- bcopy(((char *)(tdp))+gdb_descriptor_length(tdp->field_count),
- nextp, tdp->str_len); /* copy the string data all */
+ memcpy(nextp,((char *)(tdp))+gdb_descriptor_length(tdp->field_count),
+ tdp->str_len); /* copy the string data all */
/* at once */
- return (int)(nextp+tdp->str_len);
+ return nextp+tdp->str_len;
}
/*----------------------------------------------------------*/
#define GDB_MAX_DECODED_FIELDS 100
-int
+char *
g_tpd_dec(outp, hcon, inp)
char *inp; /* pointer to input data */
HALF_CONNECTION hcon; /* connection descriptor */
*/
*tdp = create_tuple_descriptor(field_count, field_names, field_types);
- return (int)nextn;
+ return nextn;
}
/*----------------------------------------------------------*/
}
fprintf(gdb_log,"\n");
}
-\f
+
+
/************************************************************************/
/*
/* TUPLE_T
/*
/*----------------------------------------------------------*/
-int
+char *
g_tp_enc(dp, hcon, outp)
char *dp; /* pointer to data */
HALF_CONNECTION hcon; /* connection descriptor */
(FIELD_FROM_TUPLE(tup, i),hcon, op);
}
- return (int)op;
+ return op;
}
/*----------------------------------------------------------*/
/*
/*----------------------------------------------------------*/
-int
+char *
g_tp_dec(outp, hcon, inp)
char *inp; /* pointer to input data */
HALF_CONNECTION hcon; /* connection descriptor */
*((TUPLE *)outp) = tup; /* put the new tuple */
/* pointer where the */
/* caller wants it */
- return (int)ip;
+ return ip;
}
/*----------------------------------------------------------*/
fprintf(gdb_log,"END_OF_TUPLE\n");
}
-\f
+
+
/************************************************************************/
/*
/* TUPLE_DATA_T
/*
/*----------------------------------------------------------*/
-int
+char *
g_tdt_enc(dp, hcon, outp)
char *dp; /* pointer to data */
HALF_CONNECTION hcon; /* connection descriptor */
(FIELD_FROM_TUPLE(tup, i),hcon, op);
}
- return (int)op;
+ return op;
}
/*----------------------------------------------------------*/
/*
/*----------------------------------------------------------*/
-int
+char *
g_tdt_dec(outp, hcon, inp)
char *inp; /* pointer to input data */
HALF_CONNECTION hcon; /* connection descriptor */
(FIELD_FROM_TUPLE(tup, i),hcon, ip);
}
- return (int)ip;
+ return ip;
}
/*----------------------------------------------------------*/
fprintf(gdb_log,"END_OF_TUPLE\n");
}
-\f
+
+
/************************************************************************/
/*
/* RELATION_T
/*
/*----------------------------------------------------------*/
-int
+char *
g_rel_enc(dp, hcon, outp)
char *dp; /* pointer to data */
HALF_CONNECTION hcon; /* connection descriptor */
t = NEXT_TUPLE_IN_RELATION(rel,t))
op = (char *)g_tdt_enc((char *)t, hcon, op);
- return (int)op;
+ return op;
}
/*----------------------------------------------------------*/
/*
/*----------------------------------------------------------*/
-int
+char *
g_rel_dec(outp, hcon, inp)
char *inp; /* pointer to input data */
HALF_CONNECTION hcon; /* connection descriptor */
*((RELATION *)outp) = rel;
- return (int)ip;
+ return ip;
}
/*----------------------------------------------------------*/
fprintf(gdb_log,"END_OF_RELATION\n");
}
-\f
+
+
/************************************************************************/
/*
/* DECLARE AND INITIALIZE THE SYSTEM TYPE DEFINITION
g_type_table[inx][ALIGNMENT_PROPERTY].i = ap; \
g_type_table[inx][NULL_PROPERTY].f = np; \
g_type_table[inx][CODED_LENGTH_PROPERTY].f = clp; \
- g_type_table[inx][ENCODE_PROPERTY].f = ep; \
- g_type_table[inx][DECODE_PROPERTY].f = dp; \
+ g_type_table[inx][ENCODE_PROPERTY].cpf = ep; \
+ g_type_table[inx][DECODE_PROPERTY].cpf = dp; \
g_type_table[inx][FORMAT_PROPERTY].f = fp; \
g_type_table[inx][NAME_PROPERTY].cp = name; \
}