Correct style of comments in all source files.
libgm2/ChangeLog:
* libm2pim/Selective.c: Reformatted comments.
* libm2pim/SysExceptions.c: Reformatted comments.
* libm2pim/dtoa.c: Reformatted comments.
* libm2pim/ldtoa.c: Reformatted comments.
* libm2pim/sckt.c: Reformatted comments.
* libm2pim/termios.c: Reformatted comments.
* libm2pim/wrapc.c: Reformatted comments.
Signed-off-by: Gaius Mulley <gaius.mulley@southwales.ac.uk>
+2022-05-18 Gaius Mulley <gaius.mulley@southwales.ac.uk>
+
+ * Corrected dates on all source files.
+ * libm2pim/Selective.c: Reformatted comments.
+ * libm2pim/SysExceptions.c: Reformatted comments.
+ * libm2pim/dtoa.c: Reformatted comments.
+ * libm2pim/ldtoa.c: Reformatted comments.
+ * libm2pim/sckt.c: Reformatted comments.
+ * libm2pim/termios.c: Reformatted comments.
+ * libm2pim/wrapc.c: Reformatted comments.
+
2022-05-17 Gaius Mulley <gaius.mulley@southwales.ac.uk>
* Corrected dates on all source files.
#include <config.h>
#if defined(HAVE_STDDEF_H)
-/* to obtain a definition for NULL */
+/* Obtain a definition for NULL. */
#include <stddef.h>
#endif
#if defined(HAVE_STDIO_H)
-/* to obtain a definition for NULL */
+/* Obtain a definition for NULL. */
#include <stdio.h>
#endif
#endif
#if defined(HAVE_TIME_H)
-/* to obtain a definition for NULL */
+/* Obtain a definition for NULL. */
#include <time.h>
#endif
#if defined(HAVE_STRING_H)
-/* to obtain a definition for NULL */
+/* Obtain a definition for NULL. */
#include <string.h>
#endif
#if defined(HAVE_WCHAR_H)
-/* to obtain a definition for NULL */
+/* Obtain a definition for NULL. */
#include <wchar.h>
#endif
#if defined(HAVE_STDLIB_H)
-/* to obtain a prototype for free and malloc */
+/* Obtain a prototype for free and malloc. */
#include <stdlib.h>
#endif
#endif
-/*
- * note
- * o wholeDivException and realDivException are caught by SIGFPE and
- * depatched to the appropriate Modula-2 runtime routine upon testing
- * FPE_INTDIV or FPE_FLTDIV.
- * o realValueException is also caught by SIGFPE and dispatched by
- * testing FFE_FLTOVF or FPE_FLTUND or FPE_FLTRES or FPE_FLTINV.
- * o indexException is caught by SIGFPE and dispatched by FPE_FLTSUB.
- *
- */
+/* Note:
+
+ o wholeDivException and realDivException are caught by SIGFPE and
+ depatched to the appropriate Modula-2 runtime routine upon testing
+ FPE_INTDIV or FPE_FLTDIV.
+ o realValueException is also caught by SIGFPE and dispatched by
+ testing FFE_FLTOVF or FPE_FLTUND or FPE_FLTRES or FPE_FLTINV.
+ o indexException is caught by SIGFPE and dispatched by FPE_FLTSUB. */
#if defined(HAVE_SIGNAL_H)
static struct sigaction sigbus;
if (info)
{
if (info->si_code | FPE_INTDIV)
- (*wholedivProc) (info->si_addr); /* integer divide by zero */
+ (*wholedivProc) (info->si_addr); /* Integer divide by zero. */
if (info->si_code | FPE_INTOVF)
- (*wholevalueProc) (info->si_addr); /* integer overflow */
+ (*wholevalueProc) (info->si_addr); /* Integer overflow. */
if (info->si_code | FPE_FLTDIV)
- (*realdivProc) (info->si_addr); /* floating-point divide by zero */
+ (*realdivProc) (info->si_addr); /* Floating-point divide by zero. */
if (info->si_code | FPE_FLTOVF)
- (*realvalueProc) (info->si_addr); /* floating-point overflow */
+ (*realvalueProc) (info->si_addr); /* Floating-point overflow. */
if (info->si_code | FPE_FLTUND)
- (*realvalueProc) (info->si_addr); /* floating-point underflow */
+ (*realvalueProc) (info->si_addr); /* Floating-point underflow. */
if (info->si_code | FPE_FLTRES)
(*realvalueProc) (
- info->si_addr); /* floating-point inexact result */
+ info->si_addr); /* Floating-point inexact result. */
if (info->si_code | FPE_FLTINV)
(*realvalueProc) (
- info->si_addr); /* floating-point invalid result */
+ info->si_addr); /* Floating-point invalid result. */
if (info->si_code | FPE_FLTSUB)
- (*indexProc) (info->si_addr); /* subscript out of range */
+ (*indexProc) (info->si_addr); /* Subscript out of range. */
}
break;
default:
}
#endif
-/*
- * GNU Modula-2 linking fodder.
- */
+/* GNU Modula-2 linking fodder. */
void
_M2_SysExceptions_init (void)
#endif
#if defined(HAVE_STDDEF_H)
-/* to obtain a definition for NULL */
+/* Obtain a definition for NULL. */
#include <stddef.h>
#endif
#if defined(HAVE_STDIO_H)
-/* to obtain a definition for NULL */
+/* Obtain a definition for NULL. */
#include <stdio.h>
#endif
#if defined(HAVE_TIME_H)
-/* to obtain a definition for NULL */
+/* Obtain a definition for NULL. */
#include <time.h>
#endif
#if defined(HAVE_STRING_H)
-/* to obtain a definition for NULL */
+/* Obtain a definition for NULL. */
#include <string.h>
#endif
#if defined(HAVE_WCHAR_H)
-/* to obtain a definition for NULL */
+/* Obtain a definition for NULL. */
#include <wchar.h>
#endif
#if defined(HAVE_STDLIB_H)
-/* to obtain a prototype for free and malloc */
+/* Obtain a prototype for free and malloc. */
#include <stdlib.h>
#endif
typedef enum Mode { maxsignicant, decimaldigits } Mode;
-/*
- * maxsignicant: return a string containing max(1,ndigits) significant
- * digits. The return string contains the string produced
- * by ecvt.
- * decimaldigits: return a string produced by fcvt. The string will
- * contain ndigits past the decimal point
- * (ndigits may be negative).
- */
+/* maxsignicant: return a string containing max(1,ndigits) significant
+ digits. The return string contains the string produced by ecvt.
+
+ decimaldigits: return a string produced by fcvt. The string will
+ contain ndigits past the decimal point (ndigits may be negative). */
double
dtoa_strtod (const char *s, int *error)
return d;
}
-/*
- * dtoa_calcmaxsig - calculates the position of the decimal point
- * it also removes the decimal point and exponent
- * from string, p.
- */
+/* dtoa_calcmaxsig calculates the position of the decimal point
+ it also removes the decimal point and exponent from string, p. */
int
dtoa_calcmaxsig (char *p, int ndigits)
}
}
-/*
- * dtoa_calcdecimal - calculates the position of the decimal point
- * it also removes the decimal point and exponent
- * from string, p. It truncates the digits in p
- * accordingly to ndigits. Ie ndigits is the
- * number of digits after the '.'
- */
+/* dtoa_calcdecimal calculates the position of the decimal point
+ it also removes the decimal point and exponent from string, p.
+ It truncates the digits in p accordingly to ndigits.
+ Ie ndigits is the number of digits after the '.'. */
int
dtoa_calcdecimal (char *p, int str_size, int ndigits)
#endif
#if defined(GM2)
-/*
- * GNU Modula-2 hooks
- */
+/* GNU Modula-2 linking hooks. */
void
_M2_dtoa_init (void)
#endif
#if defined(HAVE_STDDEF_H)
-/* to obtain a definition for NULL */
+/* Obtain a definition for NULL. */
#include <stddef.h>
#endif
#if defined(HAVE_STDIO_H)
-/* to obtain a definition for NULL */
+/* Obtain a definition for NULL. */
#include <stdio.h>
#endif
#if defined(HAVE_TIME_H)
-/* to obtain a definition for NULL */
+/* Obtain a definition for NULL. */
#include <time.h>
#endif
#if defined(HAVE_STRING_H)
-/* to obtain a definition for NULL */
+/* Obtain a definition for NULL. */
#include <string.h>
#endif
#if defined(HAVE_WCHAR_H)
-/* to obtain a definition for NULL */
+/* Obtain a definition for NULL. */
#include <wchar.h>
#endif
#endif
#if defined(HAVE_STDLIB_H)
-/* to obtain a prototype for free and malloc */
+/* Obtain a prototype for free and malloc. */
#include <stdlib.h>
#endif
extern int dtoa_calcdecimal (char *p, int str_size, int ndigits);
extern int dtoa_calcsign (char *p, int str_size);
-/*
- * maxsignicant: return a string containing max(1,ndigits) significant
- * digits. The return string contains the string produced
- * by snprintf.
- * decimaldigits: return a string produced by fcvt. The string will
- * contain ndigits past the decimal point
- * (ndigits may be negative).
- */
+/* maxsignicant return a string containing max(1,ndigits) significant
+ digits. The return string contains the string produced by snprintf.
+
+ decimaldigits: return a string produced by fcvt. The string will
+ contain ndigits past the decimal point (ndigits may be negative). */
long double
ldtoa_strtold (const char *s, int *error)
#if defined(HAVE_STRTOLD)
d = strtold (s, &endp);
#else
- /* fall back to using strtod */
+ /* Fall back to using strtod. */
d = (long double)strtod (s, &endp);
#endif
if (endp != NULL && (*endp == '\0'))
{
case maxsignicant:
- ndigits += 20; /* enough for exponent */
+ ndigits += 20; /* Enough for exponent. */
p = malloc (ndigits);
snprintf (format, 50, "%s%d%s", "%.", ndigits - 20, "LE");
snprintf (p, ndigits, format, d);
}
#if defined(GM2)
-/*
- * GNU Modula-2 hooks
- */
+/* GNU Modula-2 linking hooks. */
void
_M2_ldtoa_init (void)
exit (1);
}
-/*
- * tcpServerEstablishPort - returns a tcpState containing the relevant
- * information about a socket declared to receive
- * tcp connections. This method attempts to use
- * the port specified by the parameter.
- */
+/* tcpServerEstablishPort returns a tcpState containing the relevant
+ information about a socket declared to receive tcp connections.
+ This method attempts to use the port specified by the parameter. */
tcpServerState *
tcpServerEstablishPort (int portNo)
if (s == NULL)
ERROR ("no more memory");
- /* remove SIGPIPE which is raised on the server if the client is killed */
+ /* Remove SIGPIPE which is raised on the server if the client is killed. */
signal (SIGPIPE, SIG_IGN);
if (gethostname (s->hostname, MAXHOSTNAME) < 0)
do
{
p++;
- /*
- * Open a TCP socket (an Internet stream socket)
- */
+ /* Open a TCP socket (an Internet stream socket). */
s->sockFd = socket (s->hp->h_addrtype, SOCK_STREAM, 0);
if (s->sockFd < 0)
return s;
}
-/*
- * tcpServerEstablish - returns a tcpServerState containing the relevant
- * information about a socket declared to receive
- * tcp connections.
- */
+/* tcpServerEstablish returns a tcpServerState containing the relevant
+ information about a socket declared to receive tcp connections. */
tcpServerState *
tcpServerEstablish (void)
return tcpServerEstablishPort (PORTSTART);
}
-/*
- * tcpServerAccept - returns a file descriptor once a client has connected and
- * been accepted.
- */
+/* tcpServerAccept returns a file descriptor once a client has connected and
+ been accepted. */
int
tcpServerAccept (tcpServerState *s)
return t;
}
-/*
- * tcpServerPortNo - returns the portNo from structure, s.
- */
+/* tcpServerPortNo returns the portNo from structure, s. */
int
tcpServerPortNo (tcpServerState *s)
return s->portNo;
}
-/*
- * tcpServerSocketFd - returns the sockFd from structure, s.
- */
+/* tcpServerSocketFd returns the sockFd from structure, s. */
int
tcpServerSocketFd (tcpServerState *s)
return s->sockFd;
}
-/*
- * getLocalIP - returns the IP address of this machine.
- */
+/* getLocalIP returns the IP address of this machine. */
unsigned int
getLocalIP (tcpServerState *s)
return 0;
}
-/*
- * tcpServerIP - returns the IP address from structure, s.
- */
+/* tcpServerIP returns the IP address from structure s. */
int
tcpServerIP (tcpServerState *s)
return *((int *)s->hp->h_addr_list[0]);
}
-/*
- * tcpServerClientIP - returns the IP address of the client who
- * has connected to server, s.
- */
+/* tcpServerClientIP returns the IP address of the client who
+ has connected to server s. */
unsigned int
tcpServerClientIP (tcpServerState *s)
return ip;
}
-/*
- * tcpServerClientPortNo - returns the port number of the client who
- * has connected to server, s.
- */
+/* tcpServerClientPortNo returns the port number of the client who
+ has connected to server s. */
unsigned int
tcpServerClientPortNo (tcpServerState *s)
int portNo;
} tcpClientState;
-/*
- * tcpClientSocket - returns a file descriptor (socket) which has
- * connected to, serverName:portNo.
- */
+/* tcpClientSocket returns a file descriptor (socket) which has
+ connected to, serverName:portNo. */
tcpClientState *
tcpClientSocket (char *serverName, int portNo)
if (s == NULL)
ERROR ("no more memory");
- /* remove SIGPIPE which is raised on the server if the client is killed */
+ /* Remove SIGPIPE which is raised on the server if the client is killed. */
signal (SIGPIPE, SIG_IGN);
s->hp = gethostbyname (serverName);
s->portNo = portNo;
s->sa.sin_port = htons (portNo);
- /*
- * Open a TCP socket (an Internet stream socket)
- */
+ /* Open a TCP socket (an Internet stream socket). */
s->sockFd = socket (s->hp->h_addrtype, SOCK_STREAM, 0);
return s;
}
-/*
- * tcpClientSocketIP - returns a file descriptor (socket) which has
- * connected to, ip:portNo.
- */
+/* tcpClientSocketIP returns a file descriptor (socket) which has
+ connected to, ip:portNo. */
tcpClientState *
tcpClientSocketIP (unsigned int ip, int portNo)
if (s == NULL)
ERROR ("no more memory");
- /* remove SIGPIPE which is raised on the server if the client is killed */
+ /* Remove SIGPIPE which is raised on the server if the client is killed. */
signal (SIGPIPE, SIG_IGN);
memset ((void *)&s->sa, 0, sizeof (s->sa));
s->portNo = portNo;
s->sa.sin_port = htons (portNo);
- /*
- * Open a TCP socket (an Internet stream socket)
- */
+ /* Open a TCP socket (an Internet stream socket). */
s->sockFd = socket (PF_INET, SOCK_STREAM, 0);
return s;
}
-/*
- * tcpClientConnect - returns the file descriptor associated with, s,
- * once a connect has been performed.
- */
+/* tcpClientConnect returns the file descriptor associated with s,
+ once a connect has been performed. */
int
tcpClientConnect (tcpClientState *s)
return s->sockFd;
}
-/*
- * tcpClientPortNo - returns the portNo from structure, s.
- */
+/* tcpClientPortNo returns the portNo from structure s. */
int
tcpClientPortNo (tcpClientState *s)
return s->portNo;
}
-/*
- * tcpClientSocketFd - returns the sockFd from structure, s.
- */
+/* tcpClientSocketFd returns the sockFd from structure s. */
int
tcpClientSocketFd (tcpClientState *s)
return s->sockFd;
}
-/*
- * tcpClientIP - returns the sockFd from structure, s.
- */
+/* tcpClientIP returns the sockFd from structure s. */
int
tcpClientIP (tcpClientState *s)
}
#endif
-/*
- * GNU Modula-2 link fodder.
- */
+/* GNU Modula-2 link fodder. */
void
_M2_sckt_init (void)
parodd,
hupcl,
clocal,
- /* local flags */
+ /* Local flags. */
lisig,
licanon,
lxcase,
liexten
} Flag;
-/* prototypes */
+/* Prototypes. */
void *EXPORT (InitTermios) (void);
void *EXPORT (KillTermios) (struct termios *p);
int EXPORT (cfgetospeed) (struct termios *t);
#define NULL 0
#endif
-/* strtime - returns the address of a string which describes the
+/* strtime returns the address of a string which describes the
local time. */
char *
#endif
}
-/* filemtime - returns the mtime of a file, f. */
+/* filemtime returns the mtime of a file, f. */
int
wrapc_filemtime (int f)
#endif
}
-/* fileinode - returns the inode associated with a file, f. */
+/* fileinode returns the inode associated with a file, f. */
#if defined(HAVE_SYS_STAT_H) && defined(HAVE_STRUCT_STAT)
ino_t
}
#endif
-/* getrand - returns a random number between 0..n-1 */
+/* getrand returns a random number between 0..n-1. */
int
wrapc_getrand (int n)
return getpwuid (getuid ())->pw_gecos;
}
-/* getnameuidgid - fills in the, uid, and, gid, which represents
+/* getnameuidgid fills in the, uid, and, gid, which represents
user, name. */
void
#if defined(HAVE_SIGNBIT)
/* signbit is a macro which tests its argument against sizeof(float),
- sizeof(double) */
+ sizeof(double). */
return signbit (r);
#else
return FALSE;
#if defined(HAVE_SIGNBITL)
/* signbit is a macro which tests its argument against sizeof(float),
- sizeof(double) */
+ sizeof(double). */
return signbitl (r);
#else
return FALSE;
#if defined(HAVE_SIGNBITF)
/* signbit is a macro which tests its argument against sizeof(float),
- sizeof(double) */
+ sizeof(double). */
return signbitf (r);
#else
return FALSE;
#endif
}
-/* isfinite - provide non builtin alternative to the gcc builtin
+/* isfinite provide non builtin alternative to the gcc builtin
isfinite. Returns 1 if x is finite and 0 if it is not. */
int
#endif
}
-/* isfinitel - provide non builtin alternative to the gcc builtin
+/* isfinitel provide non builtin alternative to the gcc builtin
isfinite. Returns 1 if x is finite and 0 if it is not. */
int
#endif
}
-/* isfinitef - provide non builtin alternative to the gcc builtin
+/* isfinitef provide non builtin alternative to the gcc builtin
isfinite. Returns 1 if x is finite and 0 if it is not. */
int
#endif
}
-/* init - init/finish functions for the module. */
+/* init/finish are GNU Modula-2 linking fodder. */
void
_M2_wrapc_init ()