convert K&R function definitions to ansi style

This commit is contained in:
rlar 2010-06-27 09:27:49 +00:00
parent ad947547a8
commit c79d21af82
17 changed files with 160 additions and 125 deletions

View File

@ -1,3 +1,22 @@
2010-06-27 Robert Larice
* src/main.c,
* src/spicelib/devices/dev.c,
* src/xspice/cm/cmmeters.c,
* src/xspice/cmpp/ifs_lex.l,
* src/xspice/cmpp/ifs_yacc.y,
* src/xspice/cmpp/mod_yacc.y,
* src/xspice/cmpp/pp_mod.c,
* src/xspice/cmpp/read_ifs.c,
* src/xspice/icm/digital/d_source/cfunc.mod,
* src/xspice/icm/digital/d_state/cfunc.mod,
* src/xspice/icm/dlmain.c,
* src/xspice/ipc/ipc.c,
* src/xspice/ipc/ipcsockets.c,
* src/xspice/ipc/ipctiein.c,
* src/xspice/mif/mif_inp2.c,
* src/xspice/mif/mifgetvalue.c :
convert K&R function definitions to ansi style
2010-06-26 Robert Larice
* src/include/opdefs.h,
* src/include/trandefs.h :

View File

@ -484,7 +484,7 @@ prompt(void)
/* Process device events in Readline's hook since there is no where
else to do it now - AV */
static int
rl_event_func()
rl_event_func(void)
/* called by GNU readline periodically to know what to do about keypresses */
{
static REQUEST reqst = { checkup_option, 0 };

View File

@ -354,7 +354,7 @@ void load_alldevs(void){
#include "fteext.h" /* for ft_sim */
#include "cktdefs.h" /* for DEVmaxnum */
static void relink() {
static void relink(void) {
/* added by SDB; DEVmaxnum is an external int defined in cktdefs.h */
extern int DEVmaxnum;

View File

@ -61,7 +61,7 @@ model. It returns the parallel combination of the capacitance
connected to the first port on the instance.
*/
double cm_netlist_get_c()
double cm_netlist_get_c(void)
{
CKTcircuit *ckt;
@ -192,7 +192,7 @@ connected to the first port on the instance.
*/
double cm_netlist_get_l()
double cm_netlist_get_l(void)
{
CKTcircuit *ckt;

View File

@ -174,7 +174,7 @@ false {return TOK_BOOL_NO;}
%%
/*--------------------------------------------------------------------------*/
void reset_lex_context ()
void reset_lex_context (void)
{
BEGIN 0;
}

View File

@ -176,8 +176,8 @@ static void fatal (char *str)
}
/*---------------------------------------------------------------------------*/
static int find_conn_ref (name)
char *name;
static int
find_conn_ref (char *name)
{
int i;
char str[130];
@ -268,9 +268,8 @@ static void check_default_type (Conn_Info_t conn)
}
/*---------------------------------------------------------------------------*/
static void assign_ctype_list (conn, ctype_list)
Conn_Info_t *conn;
Ctype_List_t *ctype_list;
static void
assign_ctype_list (Conn_Info_t *conn, Ctype_List_t *ctype_list )
{
int i;
Ctype_List_t *p;
@ -302,10 +301,8 @@ static void assign_ctype_list (conn, ctype_list)
}
/*---------------------------------------------------------------------------*/
static void assign_value (type, dest_value, src_value)
Data_Type_t type;
Value_t *dest_value;
My_Value_t src_value;
static void
assign_value (Data_Type_t type, Value_t *dest_value, My_Value_t src_value)
{
char str[200];
if ((type == REAL) && (src_value.kind == INTEGER)) {
@ -339,10 +336,8 @@ static void assign_value (type, dest_value, src_value)
}
/*---------------------------------------------------------------------------*/
static void assign_limits (type, param, range)
Data_Type_t type;
Param_Info_t *param;
Range_t range;
static void
assign_limits (Data_Type_t type, Param_Info_t *param, Range_t range)
{
if (range.is_named) {
yyerror ("Named range not allowed for limits");
@ -358,7 +353,8 @@ static void assign_limits (type, param, range)
}
/*---------------------------------------------------------------------------*/
static void check_item_num ()
static void
check_item_num (void)
{
if (item-item_offset >= ITEM_BUFFER_SIZE) {
fatal ("Too many items in table - split into sub-tables");
@ -400,7 +396,8 @@ static void check_item_num ()
}
/*---------------------------------------------------------------------------*/
static void check_end_item_num ()
static void
check_end_item_num (void)
{
if (num_items_fixed) {
if (item != num_items) {

View File

@ -122,9 +122,8 @@ static char *subscript (Sub_Id_t sub_id)
}
/*--------------------------------------------------------------------------*/
int local_strcmpi(s, t)
char *s;
char *t;
int
local_strcmpi(char *s, char *t)
/* string compare - case insensitive */
{
for (; *s && t && tolower(*s) == tolower(*t); s++, t++);
@ -306,7 +305,7 @@ static int valid_subid (Sub_Id_t sub_id, Id_Kind_t kind)
}
/*---------------------------------------------------------------------------*/
static void init_buffer ()
static void init_buffer (void)
{
buf_len = 0;
buffer[0] = '\0';

View File

@ -174,8 +174,8 @@ void preprocess_mod_file (
}
/*---------------------------------------------------------------------------*/
int mod_yyerror (str)
char *str;
int
mod_yyerror (char *str)
{
extern int mod_yylineno;
extern char *mod_yytext;

View File

@ -166,8 +166,8 @@ static Status_t read_ifs_table(
}
/*---------------------------------------------------------------------------*/
int ifs_yyerror (str)
char *str;
int
ifs_yyerror (char *str)
{
extern int ifs_yylineno;
extern char *ifs_yytext;

View File

@ -333,10 +333,9 @@ deck and returns a floating point equivalent value.
*/
static int cnv_get_spice_value(str,p_value)
char *str; /* IN - The value text e.g. 1.2K */
float *p_value; /* OUT - The numerical value */
static int cnv_get_spice_value(
char *str, /* IN - The value text e.g. 1.2K */
float *p_value ) /* OUT - The numerical value */
{

View File

@ -392,10 +392,9 @@ deck and returns a floating point equivalent value.
*/
static int cnv_get_spice_value(str,p_value)
char *str; /* IN - The value text e.g. 1.2K */
float *p_value; /* OUT - The numerical value */
static int cnv_get_spice_value(
char *str, /* IN - The value text e.g. 1.2K */
float *p_value ) /* OUT - The numerical value */
{

View File

@ -51,27 +51,27 @@ struct coreInfo_t *coreitf;
#endif
// This one returns the device table
CM_EXPORT void *CMdevs() {
CM_EXPORT void *CMdevs(void) {
return (void *)cmDEVices;
}
// This one returns the device count
CM_EXPORT void *CMdevNum() {
CM_EXPORT void *CMdevNum(void) {
return (void *)&cmDEVicesCNT;
}
// This one returns the UDN table
CM_EXPORT void *CMudns() {
CM_EXPORT void *CMudns(void) {
return (void *)cmEVTudns;
}
// This one returns the UDN count
CM_EXPORT void *CMudnNum() {
CM_EXPORT void *CMudnNum(void) {
return (void *)&cmEVTudnCNT;
}
// This one returns the pointer to the pointer to the core interface structure
CM_EXPORT void *CMgetCoreItfPtr() {
CM_EXPORT void *CMgetCoreItfPtr(void) {
return (void *)(&coreitf);
}

View File

@ -114,9 +114,8 @@ static int batch_fd;
static char fmt_buffer [FMT_BUFFER_SIZE];
/*---------------------------------------------------------------------------*/
Ipc_Boolean_t kw_match (keyword, str)
char *keyword;
char *str;
Ipc_Boolean_t
kw_match (char *keyword, char *str)
/*
* returns IPC_TRUE if the first `strlen(keyword)' characters of `str' match
* the ones in `keyword' - case sensitive
@ -152,10 +151,11 @@ server mailbox or socket.
*/
Ipc_Status_t ipc_initialize_server (server_name, m, p)
char *server_name; /* Mailbox path or host/portnumber pair */
Ipc_Mode_t m; /* Interactive or batch */
Ipc_Protocol_t p; /* Type of IPC protocol */
Ipc_Status_t
ipc_initialize_server (
char *server_name, /* Mailbox path or host/portnumber pair */
Ipc_Mode_t m, /* Interactive or batch */
Ipc_Protocol_t p ) /* Type of IPC protocol */
/*
* For mailboxes, `server_name' would be the mailbox pathname; for
* sockets, this needs to be a host/portnumber pair. Maybe this should be
@ -203,9 +203,10 @@ This function deallocates the interprocess communication channel
mailbox or socket.
*/
Ipc_Status_t ipc_transport_terminate_server ();
Ipc_Status_t ipc_transport_terminate_server (void);
Ipc_Status_t ipc_terminate_server ()
Ipc_Status_t
ipc_terminate_server (void)
{
return ipc_transport_terminate_server ();
}
@ -221,10 +222,11 @@ beginning with a ``>'' or ``#'' character are processed internally by
this function and not returned to SPICE.
*/
Ipc_Status_t ipc_get_line (str, len, wait)
char *str; /* Text retrieved from IPC channel */
int *len; /* Length of text string */
Ipc_Wait_t wait; /* Select blocking or non-blocking */
Ipc_Status_t
ipc_get_line (
char *str, /* Text retrieved from IPC channel */
int *len, /* Length of text string */
Ipc_Wait_t wait ) /* Select blocking or non-blocking */
/*
* Reads one SPICE line from the connection. Strips any control lines
* which cannot be interpretted by the simulator (e.g. >INQCON) and
@ -371,7 +373,8 @@ This function flushes the interprocess communication channel
buffer contents.
*/
Ipc_Status_t ipc_flush ()
Ipc_Status_t
ipc_flush (void)
/*
* Flush all buffered messages out the connection.
*/
@ -429,9 +432,10 @@ Ipc_Status_t ipc_flush ()
}
/*---------------------------------------------------------------------------*/
Ipc_Status_t ipc_send_line_binary (str, len)
char *str;
int len;
Ipc_Status_t
ipc_send_line_binary (
char *str,
int len )
/*
* Same as `ipc_send_line' except does not expect the str to be null
* terminated. Sends exactly `len' characters. Use this for binary data
@ -490,8 +494,8 @@ communication channel.
*/
Ipc_Status_t ipc_send_line (str)
char *str; /* The text to send */
Ipc_Status_t
ipc_send_line (char *str ) /* The text to send */
{
int len;
int send_len;
@ -536,8 +540,8 @@ communication channel to signal that this is the beginning of a
results dump for the current analysis point.
*/
Ipc_Status_t ipc_send_data_prefix (time)
double time; /* The analysis point for this data set */
Ipc_Status_t
ipc_send_data_prefix (double time ) /* The analysis point for this data set */
{
char buffer[40];
@ -556,7 +560,8 @@ dump from a particular analysis point.
*/
Ipc_Status_t ipc_send_data_suffix ()
Ipc_Status_t
ipc_send_data_suffix (void)
{
Ipc_Status_t status;
@ -578,7 +583,8 @@ communication channel to signal that this is the beginning of a
results dump from a DC operating point analysis.
*/
Ipc_Status_t ipc_send_dcop_prefix ()
Ipc_Status_t
ipc_send_dcop_prefix (void)
{
return ipc_send_line (">DCOPB");
}
@ -594,7 +600,8 @@ dump from a particular analysis point.
*/
Ipc_Status_t ipc_send_dcop_suffix ()
Ipc_Status_t
ipc_send_dcop_suffix (void)
{
Ipc_Status_t status;
@ -620,7 +627,8 @@ The line is sent only if the IPC is configured
for UNIX sockets, indicating use with the V2 ATESSE SI process.
*/
Ipc_Status_t ipc_send_evtdict_prefix ()
Ipc_Status_t
ipc_send_evtdict_prefix (void)
{
#ifdef IPC_AEGIS_MAILBOXES
return IPC_STATUS_OK;
@ -643,7 +651,8 @@ for UNIX sockets, indicating use with the V2 ATESSE SI process.
*/
Ipc_Status_t ipc_send_evtdict_suffix ()
Ipc_Status_t
ipc_send_evtdict_suffix (void)
{
#ifdef IPC_AEGIS_MAILBOXES
return IPC_STATUS_OK;
@ -673,7 +682,8 @@ The line is sent only if the IPC is configured
for UNIX sockets, indicating use with the V2 ATESSE SI process.
*/
Ipc_Status_t ipc_send_evtdata_prefix ()
Ipc_Status_t
ipc_send_evtdata_prefix (void)
{
#ifdef IPC_AEGIS_MAILBOXES
return IPC_STATUS_OK;
@ -696,7 +706,8 @@ for UNIX sockets, indicating use with the V2 ATESSE SI process.
*/
Ipc_Status_t ipc_send_evtdata_suffix ()
Ipc_Status_t
ipc_send_evtdata_suffix (void)
{
#ifdef IPC_AEGIS_MAILBOXES
return IPC_STATUS_OK;
@ -725,7 +736,8 @@ whether or not errors were detected.
*/
Ipc_Status_t ipc_send_errchk()
Ipc_Status_t
ipc_send_errchk(void)
{
char str[IPC_MAX_LINE_LEN+1];
Ipc_Status_t status;
@ -759,7 +771,8 @@ completed normally.
*/
Ipc_Status_t ipc_send_end()
Ipc_Status_t
ipc_send_end(void)
{
char str[IPC_MAX_LINE_LEN+1];
Ipc_Status_t status;
@ -778,11 +791,12 @@ Ipc_Status_t ipc_send_end()
/*---------------------------------------------------------------------------*/
int stuff_binary_v1 (d1, d2, n, buf, pos)
double d1, d2; /* doubles to be stuffed */
int n; /* how many of d1, d2 ( 1 <= n <= 2 ) */
char *buf; /* buffer to stuff to */
int pos; /* index at which to stuff */
int
stuff_binary_v1 (
double d1, double d2, /* doubles to be stuffed */
int n, /* how many of d1, d2 ( 1 <= n <= 2 ) */
char *buf, /* buffer to stuff to */
int pos ) /* index at which to stuff */
{
union {
float float_val[2];
@ -817,9 +831,10 @@ communication channel preceded by a character string that
identifies the simulation variable.
*/
Ipc_Status_t ipc_send_double (tag, value)
char *tag; /* The node or instance */
double value; /* The data value to send */
Ipc_Status_t
ipc_send_double (
char *tag, /* The node or instance */
double value ) /* The data value to send */
{
int i;
int len = 0;
@ -857,9 +872,10 @@ identifies the simulation variable.
*/
Ipc_Status_t ipc_send_complex (tag, value)
char *tag; /* The node or instance */
Ipc_Complex_t value; /* The data value to send */
Ipc_Status_t
ipc_send_complex (
char *tag, /* The node or instance */
Ipc_Complex_t value ) /* The data value to send */
{
int i;
int len=0;
@ -898,13 +914,14 @@ for UNIX sockets, indicating use with the V2 ATESSE SI process.
*/
Ipc_Status_t ipc_send_event(ipc_index, step, plot_val, print_val, ipc_val, len)
int ipc_index; /* Index used in EVTDICT */
double step; /* Analysis point or timestep (0.0 for DC) */
double plot_val; /* The value for plotting purposes */
char *print_val; /* The value for printing purposes */
void *ipc_val; /* The binary representation of the node data */
int len; /* The length of the binary representation */
Ipc_Status_t
ipc_send_event (
int ipc_index, /* Index used in EVTDICT */
double step, /* Analysis point or timestep (0.0 for DC) */
double plot_val, /* The value for plotting purposes */
char *print_val, /* The value for printing purposes */
void *ipc_val, /* The binary representation of the node data */
int len ) /* The length of the binary representation */
{
#ifdef IPC_AEGIS_MAILBOXES
return IPC_STATUS_OK;

View File

@ -158,12 +158,12 @@ NON-STANDARD FEATURES
=============================================================================*/
Ipc_Status_t ipc_transport_initialize_server (server_name, mode, protocol,
batch_filename)
char *server_name; /* not used */
Ipc_Mode_t mode; /* not used */
Ipc_Protocol_t protocol; /* IN - only used in assert */
char *batch_filename; /* OUT - returns a value */
Ipc_Status_t
ipc_transport_initialize_server (
char *server_name, /* not used */
Ipc_Mode_t mode, /* not used */
Ipc_Protocol_t protocol, /* IN - only used in assert */
char *batch_filename ) /* OUT - returns a value */
/* Note that unused parameters are required to maintain compatibility */
/* with version 1 (mailboxes) functions of the same names. */
{
@ -279,9 +279,10 @@ NON-STANDARD FEATURES
=============================================================================*/
static u_long bytes_to_integer (str, start)
char *str; /* IN - string that contains the bytes to convert */
int start; /* IN - index into string where bytes are */
static u_long
bytes_to_integer (
char *str, /* IN - string that contains the bytes to convert */
int start ) /* IN - index into string where bytes are */
{
u_long u; /* Value to be returned */
char buff[4]; /* Transfer str into buff to word align reqd data */
@ -341,7 +342,8 @@ NON-STANDARD FEATURES
=============================================================================*/
static Ipc_Status_t handle_socket_eof ()
static Ipc_Status_t
handle_socket_eof (void)
{
close (msg_stream);
close (sock_desc);
@ -390,12 +392,13 @@ NON-STANDARD FEATURES
=============================================================================*/
static int read_sock (stream, buffer, length, wait, flags)
int stream; /* IN - Socket stream */
char *buffer; /* OUT - buffer to store incoming data */
int length; /* IN - Number of bytes to be read */
Ipc_Wait_t wait; /* IN - type of read operation */
int flags; /* IN - Original socket flags for blocking read */
static int
read_sock (
int stream, /* IN - Socket stream */
char *buffer, /* OUT - buffer to store incoming data */
int length, /* IN - Number of bytes to be read */
Ipc_Wait_t wait, /* IN - type of read operation */
int flags ) /* IN - Original socket flags for blocking read */
{
int count; /* Number of bytes read with last `read` */
int totalcount; /* total number of bytes read */
@ -475,10 +478,11 @@ NON-STANDARD FEATURES
=============================================================================*/
Ipc_Status_t ipc_transport_get_line (str, len, wait)
char *str; /* returns the result, null terminated */
int *len; /* length of str passed IN and passed OUT */
Ipc_Wait_t wait; /* IN - wait or dont wait on incoming msg */
Ipc_Status_t
ipc_transport_get_line (
char *str, /* returns the result, null terminated */
int *len, /* length of str passed IN and passed OUT */
Ipc_Wait_t wait ) /* IN - wait or dont wait on incoming msg */
{
int count = 0; /* number of bytes read */
int message_length; /* extracted from message header */
@ -635,9 +639,10 @@ NON-STANDARD FEATURES
=============================================================================*/
Ipc_Status_t ipc_transport_send_line (str, len)
char *str; /* IN - String to write */
int len; /* IN - Number of characters out of STR to write */
Ipc_Status_t
ipc_transport_send_line (
char *str, /* IN - String to write */
int len ) /* IN - Number of characters out of STR to write */
{
int count; /* Counts how many bytes were actually written */
u_long u; /* 32-bit placeholder for transmission of LEN */
@ -717,7 +722,8 @@ NON-STANDARD FEATURES
=============================================================================*/
Ipc_Status_t ipc_transport_terminate_server ()
Ipc_Status_t
ipc_transport_terminate_server (void)
{
char buffer[17000]; /* temp buffer for incoming data */
int len; /* placeholder var to as arg to function */

View File

@ -281,7 +281,7 @@ IPC channel. These streams were previously redirected to temporary
files during the simulation.
*/
Ipc_Status_t ipc_send_std_files()
Ipc_Status_t ipc_send_std_files(void)
{
ipc_send_stdout();
ipc_send_stderr();

View File

@ -148,11 +148,10 @@ and error checks are performed.
-------------------------------------------------------------------------*/
void
MIF_INP2A(ckt,tab,current)
void *ckt; /* circuit structure to put mod/inst structs in */
INPtables *tab; /* symbol table for node names, etc. */
card *current; /* the card we are to parse */
MIF_INP2A (
void *ckt, /* circuit structure to put mod/inst structs in */
INPtables *tab, /* symbol table for node names, etc. */
card *current ) /* the card we are to parse */
/* Must be called "current" for compatibility */
/* with macros */
{

View File

@ -83,12 +83,12 @@ the number of elements found.
IFvalue *
MIFgetValue(ckt,line,type,tab,err)
void *ckt; /* The circuit structure */
char **line; /* The text line to read value from */
int type; /* The type of data to read */
INPtables *tab; /* Unused */
char **err; /* Error string text */
MIFgetValue (
void *ckt, /* The circuit structure */
char **line, /* The text line to read value from */
int type, /* The type of data to read */
INPtables *tab, /* Unused */
char **err ) /* Error string text */
{
static IFvalue val;