File: nocommen.c

package info (click to toggle)
icmake 6.22-7
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 2,148 kB
  • ctags: 1,042
  • sloc: ansic: 9,241; makefile: 1,134; sh: 235; asm: 126
file content (32 lines) | stat: -rw-r--r-- 960 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*
                                N O C O M M E N . C

    The function no_comment() removes comment found on a #define-line
    before entering the define-definition.

    The define-line is stored in lexbuf[]
*/

#include "icm-pp.h"

void no_comment()
{
    char
        *cp;                                /* look for / */

    cp = lexbuf;                            /* get first char-address */

    while ((cp = strchr(cp, '/')))          /* any slash ? */
    {
        if (*(cp + 1) == '/')               /* next one is a slash too: */
        {
            *cp = 0;                        /* so we have eoln-comment   */
            return;                         /* and the define stops here */
        }

        if (*(cp + 1) == '*')               /* we have std comment    */
            delete_std_comment(cp);         /* delete the std comment */
        else
            cp++;                           /* else skip the /  */        
    }
}