prettyness police
[unix-history] / usr / src / usr.bin / ctags / fortran.c
index edb699f..eb838dd 100644 (file)
@@ -1,35 +1,42 @@
 /*
 /*
- * Copyright (c) 1987 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1987, 1993
+ *     The Regents of the University of California.  All rights reserved.
  *
  * %sccs.include.redist.c%
  */
 
 #ifndef lint
  *
  * %sccs.include.redist.c%
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)fortran.c  5.4 (Berkeley) %G%";
+static char sccsid[] = "@(#)fortran.c  8.2 (Berkeley) %G%";
 #endif /* not lint */
 
 #endif /* not lint */
 
-#include <ctags.h>
+#include <ctype.h>
+#include <limits.h>
+#include <stdio.h>
 #include <string.h>
 
 #include <string.h>
 
-char   *lbp;                           /* line buffer pointer */
+#include "ctags.h"
 
 
+static void takeprec __P((void));
+
+char *lbp;                             /* line buffer pointer */
+
+int
 PF_funcs()
 {
 PF_funcs()
 {
-       register bool   pfcnt;          /* pascal/fortran functions found */
-       register char   *cp;
-       char    tok[MAXTOKEN],
-               *gettoken();
+       bool    pfcnt;                  /* pascal/fortran functions found */
+       char    *cp;
+       char    tok[MAXTOKEN];
 
        for (pfcnt = NO;;) {
                lineftell = ftell(inf);
 
        for (pfcnt = NO;;) {
                lineftell = ftell(inf);
-               if (!fgets(lbuf,sizeof(lbuf),inf))
-                       return(pfcnt);
+               if (!fgets(lbuf, sizeof(lbuf), inf))
+                       return (pfcnt);
                ++lineno;
                lbp = lbuf;
                if (*lbp == '%')        /* Ratfor escape to fortran */
                        ++lbp;
                ++lineno;
                lbp = lbuf;
                if (*lbp == '%')        /* Ratfor escape to fortran */
                        ++lbp;
-               for (;isspace(*lbp);++lbp);
+               for (; isspace(*lbp); ++lbp)
+                       continue;
                if (!*lbp)
                        continue;
                switch (*lbp | ' ') {   /* convert to lower-case */
                if (!*lbp)
                        continue;
                switch (*lbp | ' ') {   /* convert to lower-case */
@@ -39,7 +46,8 @@ PF_funcs()
                        break;
                case 'd':
                        if (cicmp("double")) {
                        break;
                case 'd':
                        if (cicmp("double")) {
-                               for (;isspace(*lbp);++lbp);
+                               for (; isspace(*lbp); ++lbp)
+                                       continue;
                                if (!*lbp)
                                        continue;
                                if (cicmp("precision"))
                                if (!*lbp)
                                        continue;
                                if (cicmp("precision"))
@@ -60,7 +68,8 @@ PF_funcs()
                                takeprec();
                        break;
                }
                                takeprec();
                        break;
                }
-               for (;isspace(*lbp);++lbp);
+               for (; isspace(*lbp); ++lbp)
+                       continue;
                if (!*lbp)
                        continue;
                switch (*lbp | ' ') {
                if (!*lbp)
                        continue;
                switch (*lbp | ' ') {
@@ -78,16 +87,18 @@ PF_funcs()
                default:
                        continue;
                }
                default:
                        continue;
                }
-               for (;isspace(*lbp);++lbp);
+               for (; isspace(*lbp); ++lbp)
+                       continue;
                if (!*lbp)
                        continue;
                if (!*lbp)
                        continue;
-               for (cp = lbp + 1;*cp && intoken(*cp);++cp);
+               for (cp = lbp + 1; *cp && intoken(*cp); ++cp)
+                       continue;
                if (cp = lbp + 1)
                        continue;
                *cp = EOS;
                if (cp = lbp + 1)
                        continue;
                *cp = EOS;
-               (void)strcpy(tok,lbp);
+               (void)strcpy(tok, lbp);
                getline();                      /* process line for ex(1) */
                getline();                      /* process line for ex(1) */
-               pfnote(tok,lineno);
+               pfnote(tok, lineno);
                pfcnt = YES;
        }
        /*NOTREACHED*/
                pfcnt = YES;
        }
        /*NOTREACHED*/
@@ -97,30 +108,35 @@ PF_funcs()
  * cicmp --
  *     do case-independent strcmp
  */
  * cicmp --
  *     do case-independent strcmp
  */
+int
 cicmp(cp)
 cicmp(cp)
-       register char   *cp;
+       char    *cp;
 {
 {
-       register int    len;
-       register char   *bp;
+       int     len;
+       char    *bp;
 
 
-       for (len = 0,bp = lbp;*cp && (*cp &~ ' ') == (*bp++ &~ ' ');
-           ++cp,++len);
+       for (len = 0, bp = lbp; *cp && (*cp &~ ' ') == (*bp++ &~ ' ');
+           ++cp, ++len)
+               continue;
        if (!*cp) {
                lbp += len;
        if (!*cp) {
                lbp += len;
-               return(YES);
+               return (YES);
        }
        }
-       return(NO);
+       return (NO);
 }
 
 }
 
-static
+static void
 takeprec()
 {
 takeprec()
 {
-       for (;isspace(*lbp);++lbp);
+       for (; isspace(*lbp); ++lbp)
+               continue;
        if (*lbp == '*') {
        if (*lbp == '*') {
-               for (++lbp;isspace(*lbp);++lbp);
+               for (++lbp; isspace(*lbp); ++lbp)
+                       continue;
                if (!isdigit(*lbp))
                        --lbp;                  /* force failure */
                else
                if (!isdigit(*lbp))
                        --lbp;                  /* force failure */
                else
-                       while (isdigit(*++lbp));
+                       while (isdigit(*++lbp))
+                               continue;
        }
 }
        }
 }