Run through clang-format before editing.
authorDavid Given <dg@cowlark.com>
Sun, 2 Sep 2018 09:49:40 +0000 (11:49 +0200)
committerDavid Given <dg@cowlark.com>
Sun, 2 Sep 2018 09:49:40 +0000 (11:49 +0200)
lang/cem/cemcom.ansi/skip.c
lang/cem/cpp.ansi/skip.c

index d4a6714..a3eabe2 100644 (file)
@@ -5,55 +5,61 @@
 /* $Id$ */
 /* PREPROCESSOR: INPUT SKIP FUNCTIONS */
 
-#include       "parameters.h"
-#include       "arith.h"
-#include       "LLlex.h"
-#include       "class.h"
-#include       "input.h"
+#include "parameters.h"
+#include "arith.h"
+#include "LLlex.h"
+#include "class.h"
+#include "input.h"
 
 #ifndef NOPP
 extern int InputLevel;
 
-int
-skipspaces(ch, skipnl)
-       register int ch;
+int skipspaces(ch, skipnl) register int ch;
 {
        /*      skipspaces() skips any white space and returns the first
-               non-space character.
+           non-space character.
        */
        register int nlseen = 0;
 
-       for (;;) {
+       for (;;)
+       {
                while (class(ch) == STSKIP)
                        ch = GetChar();
-               if (skipnl && class(ch) == STNL) {
+               if (skipnl && class(ch) == STNL)
+               {
                        ch = GetChar();
                        LineNumber++;
                        nlseen++;
                        continue;
                }
-               if (ch == TOKSEP && InputLevel) {
+               if (ch == TOKSEP && InputLevel)
+               {
                        ch = GetChar();
                        continue;
                }
 
                /* \\\n are handled by trigraph */
 
-               if (ch == '/') {
+               if (ch == '/')
+               {
                        ch = GetChar();
-                       if (ch == '*' && !InputLevel) {
+                       if (ch == '*' && !InputLevel)
+                       {
                                skipcomment();
                                ch = GetChar();
                        }
-                       else    {
+                       else
+                       {
                                UnGetChar();
                                return '/';
                        }
                }
-               else if (nlseen && ch == '#') {
+               else if (nlseen && ch == '#')
+               {
                        domacro();
                        ch = GetChar();
-               } else
+               }
+               else
                        return ch;
        }
 }
@@ -63,41 +69,52 @@ SkipToNewLine()
 {
        register int ch;
        register int garbage = 0;
-#ifndef        NOPP
+#ifndef NOPP
        register int delim = 0;
 #endif
 
-       while ((ch = GetChar()) != '\n') {
+       while ((ch = GetChar()) != '\n')
+       {
 #ifndef NOPP
-               if (delim) {
-                       if (ch == '\\') {
-                               if (GetChar() == '\n') break;
-                       } else if (ch == delim) {
+               if (delim)
+               {
+                       if (ch == '\\')
+                       {
+                               if (GetChar() == '\n')
+                                       break;
+                       }
+                       else if (ch == delim)
+                       {
                                delim = 0;
                        }
                        continue;
                }
-               else if (ch == '\'' || ch == '\"') {
+               else if (ch == '\'' || ch == '\"')
+               {
                        delim = ch;
                        garbage = 1;
-               } else if (ch == '/') {
-                       if (GetChar() == '*'
-                           && !InputLevel
-                       ) {
+               }
+               else if (ch == '/')
+               {
+                       if (GetChar() == '*' && !InputLevel)
+                       {
                                skipcomment();
                                continue;
                        }
-                       else UnGetChar();
+                       else
+                               UnGetChar();
                }
-               else if (ch == TOKSEP && InputLevel) {
+               else if (ch == TOKSEP && InputLevel)
+               {
                        continue;
                }
 #endif
                if (!is_wsp(ch))
                        garbage = 1;
        }
-#ifndef        NOPP
-       if (delim) strict("unclosed opening %c", delim);
+#ifndef NOPP
+       if (delim)
+               strict("unclosed opening %c", delim);
 #endif
        ++LineNumber;
        return garbage;
index e9990ce..329cef0 100644 (file)
@@ -5,53 +5,59 @@
 /* $Id$ */
 /* PREPROCESSOR: INPUT SKIP FUNCTIONS */
 
-#include       "arith.h"
-#include       "LLlex.h"
-#include       "class.h"
-#include       "input.h"
+#include "arith.h"
+#include "LLlex.h"
+#include "class.h"
+#include "input.h"
 
 extern int InputLevel;
 
-int
-skipspaces(ch, skipnl)
-       register int ch;
+int skipspaces(ch, skipnl) register int ch;
 {
        /*      skipspaces() skips any white space and returns the first
-               non-space character.
+           non-space character.
        */
        register int nlseen = 0;
 
-       for (;;) {
+       for (;;)
+       {
                while (class(ch) == STSKIP)
                        ch = GetChar();
-               if (skipnl && class(ch) == STNL) {
+               if (skipnl && class(ch) == STNL)
+               {
                        ch = GetChar();
                        LineNumber++;
                        nlseen++;
                        continue;
                }
-               if (ch == TOKSEP && InputLevel) {
+               if (ch == TOKSEP && InputLevel)
+               {
                        ch = GetChar();
                        continue;
                }
 
                /* \\\n are handled by trigraph */
 
-               if (ch == '/') {
+               if (ch == '/')
+               {
                        ch = GetChar();
-                       if (ch == '*' && !InputLevel) {
+                       if (ch == '*' && !InputLevel)
+                       {
                                skipcomment();
                                ch = GetChar();
                        }
-                       else    {
+                       else
+                       {
                                UnGetChar();
                                return '/';
                        }
                }
-               else if (nlseen && ch == '#') {
+               else if (nlseen && ch == '#')
+               {
                        domacro();
                        ch = GetChar();
-               } else
+               }
+               else
                        return ch;
        }
 }
@@ -62,31 +68,45 @@ SkipToNewLine()
        register int garbage = 0;
        register int delim = 0;
 
-       while ((ch = GetChar()) != '\n') {
-               if (delim) {
-                       if (ch == '\\') {
-                               if (GetChar() == '\n') break;
-                       } else if (ch == delim) {
+       while ((ch = GetChar()) != '\n')
+       {
+               if (delim)
+               {
+                       if (ch == '\\')
+                       {
+                               if (GetChar() == '\n')
+                                       break;
+                       }
+                       else if (ch == delim)
+                       {
                                delim = 0;
                        }
                        continue;
-               } else if (ch == '\'' || ch == '\"') {
+               }
+               else if (ch == '\'' || ch == '\"')
+               {
                        delim = ch;
                        garbage = 1;
-               } else if (ch == '/') {
-                       if (GetChar() == '*' && !InputLevel) {
+               }
+               else if (ch == '/')
+               {
+                       if (GetChar() == '*' && !InputLevel)
+                       {
                                skipcomment();
                                continue;
                        }
-                       else UnGetChar();
+                       else
+                               UnGetChar();
                }
-               else if (ch == TOKSEP && InputLevel) {
+               else if (ch == TOKSEP && InputLevel)
+               {
                        continue;
                }
                if (!is_wsp(ch))
                        garbage = 1;
        }
-       if (delim) strict("unclosed opening %c", delim);
+       if (delim)
+               strict("unclosed opening %c", delim);
        ++LineNumber;
        return garbage;
 }