From: Gaius Mulley Date: Wed, 18 May 2022 16:49:03 +0000 (+0100) Subject: libgm2/libm2pim use GNU coding standard comment style. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bf9e93834c7b35370603baa4ab6791927652d2ad;p=thirdparty%2Fgcc.git libgm2/libm2pim use GNU coding standard comment style. 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 --- diff --git a/libgm2/ChangeLog b/libgm2/ChangeLog index 3e63497dec81..edd5fca152c2 100644 --- a/libgm2/ChangeLog +++ b/libgm2/ChangeLog @@ -1,3 +1,14 @@ +2022-05-18 Gaius Mulley + + * 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 * Corrected dates on all source files. diff --git a/libgm2/libm2pim/Selective.c b/libgm2/libm2pim/Selective.c index e03c68bd9ff5..593d3d884c9a 100644 --- a/libgm2/libm2pim/Selective.c +++ b/libgm2/libm2pim/Selective.c @@ -27,12 +27,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include #if defined(HAVE_STDDEF_H) -/* to obtain a definition for NULL */ +/* Obtain a definition for NULL. */ #include #endif #if defined(HAVE_STDIO_H) -/* to obtain a definition for NULL */ +/* Obtain a definition for NULL. */ #include #endif @@ -41,22 +41,22 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #endif #if defined(HAVE_TIME_H) -/* to obtain a definition for NULL */ +/* Obtain a definition for NULL. */ #include #endif #if defined(HAVE_STRING_H) -/* to obtain a definition for NULL */ +/* Obtain a definition for NULL. */ #include #endif #if defined(HAVE_WCHAR_H) -/* to obtain a definition for NULL */ +/* Obtain a definition for NULL. */ #include #endif #if defined(HAVE_STDLIB_H) -/* to obtain a prototype for free and malloc */ +/* Obtain a prototype for free and malloc. */ #include #endif diff --git a/libgm2/libm2pim/SysExceptions.c b/libgm2/libm2pim/SysExceptions.c index 59d7cbff5561..50779b55f00e 100644 --- a/libgm2/libm2pim/SysExceptions.c +++ b/libgm2/libm2pim/SysExceptions.c @@ -91,16 +91,14 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #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; @@ -150,23 +148,23 @@ sigfpeDespatcher (int signum, siginfo_t *info, void *ucontext) 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: @@ -237,9 +235,7 @@ SysExceptions_InitExceptionHandlers (void *indexf, void *range, void *casef, } #endif -/* - * GNU Modula-2 linking fodder. - */ +/* GNU Modula-2 linking fodder. */ void _M2_SysExceptions_init (void) diff --git a/libgm2/libm2pim/dtoa.c b/libgm2/libm2pim/dtoa.c index 0a079a5be038..9dcf2f45cd26 100644 --- a/libgm2/libm2pim/dtoa.c +++ b/libgm2/libm2pim/dtoa.c @@ -37,32 +37,32 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #endif #if defined(HAVE_STDDEF_H) -/* to obtain a definition for NULL */ +/* Obtain a definition for NULL. */ #include #endif #if defined(HAVE_STDIO_H) -/* to obtain a definition for NULL */ +/* Obtain a definition for NULL. */ #include #endif #if defined(HAVE_TIME_H) -/* to obtain a definition for NULL */ +/* Obtain a definition for NULL. */ #include #endif #if defined(HAVE_STRING_H) -/* to obtain a definition for NULL */ +/* Obtain a definition for NULL. */ #include #endif #if defined(HAVE_WCHAR_H) -/* to obtain a definition for NULL */ +/* Obtain a definition for NULL. */ #include #endif #if defined(HAVE_STDLIB_H) -/* to obtain a prototype for free and malloc */ +/* Obtain a prototype for free and malloc. */ #include #endif @@ -98,14 +98,11 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 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) @@ -128,11 +125,8 @@ 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) @@ -160,13 +154,10 @@ 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) @@ -246,9 +237,7 @@ dtoa_dtoa (double d, int mode, int ndigits, int *decpt, int *sign) #endif #if defined(GM2) -/* - * GNU Modula-2 hooks - */ +/* GNU Modula-2 linking hooks. */ void _M2_dtoa_init (void) diff --git a/libgm2/libm2pim/ldtoa.c b/libgm2/libm2pim/ldtoa.c index 540ee70b13e2..5e2a42bc5157 100644 --- a/libgm2/libm2pim/ldtoa.c +++ b/libgm2/libm2pim/ldtoa.c @@ -37,27 +37,27 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #endif #if defined(HAVE_STDDEF_H) -/* to obtain a definition for NULL */ +/* Obtain a definition for NULL. */ #include #endif #if defined(HAVE_STDIO_H) -/* to obtain a definition for NULL */ +/* Obtain a definition for NULL. */ #include #endif #if defined(HAVE_TIME_H) -/* to obtain a definition for NULL */ +/* Obtain a definition for NULL. */ #include #endif #if defined(HAVE_STRING_H) -/* to obtain a definition for NULL */ +/* Obtain a definition for NULL. */ #include #endif #if defined(HAVE_WCHAR_H) -/* to obtain a definition for NULL */ +/* Obtain a definition for NULL. */ #include #endif @@ -77,7 +77,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #endif #if defined(HAVE_STDLIB_H) -/* to obtain a prototype for free and malloc */ +/* Obtain a prototype for free and malloc. */ #include #endif @@ -100,14 +100,11 @@ extern int dtoa_calcmaxsig (char *p, int ndigits); 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) @@ -121,7 +118,7 @@ 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')) @@ -145,7 +142,7 @@ ldtoa_ldtoa (long double d, int mode, int ndigits, int *decpt, int *sign) { 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); @@ -165,9 +162,7 @@ ldtoa_ldtoa (long double d, int mode, int ndigits, int *decpt, int *sign) } #if defined(GM2) -/* - * GNU Modula-2 hooks - */ +/* GNU Modula-2 linking hooks. */ void _M2_ldtoa_init (void) diff --git a/libgm2/libm2pim/sckt.c b/libgm2/libm2pim/sckt.c index 76d99349b577..f4a42ff88649 100644 --- a/libgm2/libm2pim/sckt.c +++ b/libgm2/libm2pim/sckt.c @@ -119,12 +119,9 @@ localExit (int i) 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) @@ -135,7 +132,7 @@ 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) @@ -150,9 +147,7 @@ tcpServerEstablishPort (int portNo) 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) @@ -180,11 +175,8 @@ tcpServerEstablishPort (int portNo) 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) @@ -192,10 +184,8 @@ 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) @@ -210,9 +200,7 @@ tcpServerAccept (tcpServerState *s) return t; } -/* - * tcpServerPortNo - returns the portNo from structure, s. - */ +/* tcpServerPortNo returns the portNo from structure, s. */ int tcpServerPortNo (tcpServerState *s) @@ -220,9 +208,7 @@ tcpServerPortNo (tcpServerState *s) return s->portNo; } -/* - * tcpServerSocketFd - returns the sockFd from structure, s. - */ +/* tcpServerSocketFd returns the sockFd from structure, s. */ int tcpServerSocketFd (tcpServerState *s) @@ -230,9 +216,7 @@ 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) @@ -274,9 +258,7 @@ 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) @@ -284,10 +266,8 @@ 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) @@ -300,10 +280,8 @@ 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) @@ -326,10 +304,8 @@ typedef struct 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) @@ -339,7 +315,7 @@ 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); @@ -355,18 +331,14 @@ tcpClientSocket (char *serverName, int portNo) 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) @@ -376,7 +348,7 @@ 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)); @@ -385,18 +357,14 @@ tcpClientSocketIP (unsigned int ip, int portNo) 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) @@ -407,9 +375,7 @@ tcpClientConnect (tcpClientState *s) return s->sockFd; } -/* - * tcpClientPortNo - returns the portNo from structure, s. - */ +/* tcpClientPortNo returns the portNo from structure s. */ int tcpClientPortNo (tcpClientState *s) @@ -417,9 +383,7 @@ tcpClientPortNo (tcpClientState *s) return s->portNo; } -/* - * tcpClientSocketFd - returns the sockFd from structure, s. - */ +/* tcpClientSocketFd returns the sockFd from structure s. */ int tcpClientSocketFd (tcpClientState *s) @@ -427,9 +391,7 @@ tcpClientSocketFd (tcpClientState *s) return s->sockFd; } -/* - * tcpClientIP - returns the sockFd from structure, s. - */ +/* tcpClientIP returns the sockFd from structure s. */ int tcpClientIP (tcpClientState *s) @@ -441,9 +403,7 @@ tcpClientIP (tcpClientState *s) } #endif -/* - * GNU Modula-2 link fodder. - */ +/* GNU Modula-2 link fodder. */ void _M2_sckt_init (void) diff --git a/libgm2/libm2pim/termios.c b/libgm2/libm2pim/termios.c index 8833df1cd0b9..b142fee7a581 100644 --- a/libgm2/libm2pim/termios.c +++ b/libgm2/libm2pim/termios.c @@ -167,7 +167,7 @@ typedef enum { parodd, hupcl, clocal, - /* local flags */ + /* Local flags. */ lisig, licanon, lxcase, @@ -185,7 +185,7 @@ typedef enum { liexten } Flag; -/* prototypes */ +/* Prototypes. */ void *EXPORT (InitTermios) (void); void *EXPORT (KillTermios) (struct termios *p); int EXPORT (cfgetospeed) (struct termios *t); diff --git a/libgm2/libm2pim/wrapc.c b/libgm2/libm2pim/wrapc.c index cfbcf7b98944..524ecff68327 100644 --- a/libgm2/libm2pim/wrapc.c +++ b/libgm2/libm2pim/wrapc.c @@ -66,7 +66,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #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 * @@ -102,7 +102,7 @@ wrapc_filesize (int f, unsigned int *low, unsigned int *high) #endif } -/* filemtime - returns the mtime of a file, f. */ +/* filemtime returns the mtime of a file, f. */ int wrapc_filemtime (int f) @@ -119,7 +119,7 @@ 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 @@ -146,7 +146,7 @@ wrapc_fileinode (int f, unsigned int *low, unsigned int *high) } #endif -/* getrand - returns a random number between 0..n-1 */ +/* getrand returns a random number between 0..n-1. */ int wrapc_getrand (int n) @@ -163,7 +163,7 @@ wrapc_getusername (void) 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 @@ -203,7 +203,7 @@ wrapc_signbit (double r) #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; @@ -216,7 +216,7 @@ wrapc_signbitl (long double r) #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; @@ -229,14 +229,14 @@ wrapc_signbitf (float r) #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 @@ -249,7 +249,7 @@ wrapc_isfinite (double x) #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 @@ -262,7 +262,7 @@ wrapc_isfinitel (long double x) #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 @@ -275,7 +275,7 @@ wrapc_isfinitef (float x) #endif } -/* init - init/finish functions for the module. */ +/* init/finish are GNU Modula-2 linking fodder. */ void _M2_wrapc_init ()