parser/c_compiler/main.c
author Markus Bröker <mbroeker@largo.dyndns.tv>
Thu, 16 Apr 2009 12:50:53 +0200
changeset 77 49e0babccb23
parent 48 b94d657a9acb
permissions -rw-r--r--
HEADER TAGS The std header tags are now subdir/file.ext committer: Markus Bröker <mbroeker@largo.homelinux.org>
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
37
0fbbe329c3a2 demos/parser
Markus Bröker <mbroeker@largo.localnet>
parents:
diff changeset
     1
/**
77
49e0babccb23 HEADER TAGS
Markus Bröker <mbroeker@largo.dyndns.tv>
parents: 48
diff changeset
     2
 * parser/c_compiler/main.c
37
0fbbe329c3a2 demos/parser
Markus Bröker <mbroeker@largo.localnet>
parents:
diff changeset
     3
 * Copyright (C) 2008 Markus Broeker
0fbbe329c3a2 demos/parser
Markus Bröker <mbroeker@largo.localnet>
parents:
diff changeset
     4
 */
0fbbe329c3a2 demos/parser
Markus Bröker <mbroeker@largo.localnet>
parents:
diff changeset
     5
0fbbe329c3a2 demos/parser
Markus Bröker <mbroeker@largo.localnet>
parents:
diff changeset
     6
#include <stdio.h>
0fbbe329c3a2 demos/parser
Markus Bröker <mbroeker@largo.localnet>
parents:
diff changeset
     7
#include <stdlib.h>
0fbbe329c3a2 demos/parser
Markus Bröker <mbroeker@largo.localnet>
parents:
diff changeset
     8
#include <string.h>
0fbbe329c3a2 demos/parser
Markus Bröker <mbroeker@largo.localnet>
parents:
diff changeset
     9
0fbbe329c3a2 demos/parser
Markus Bröker <mbroeker@largo.localnet>
parents:
diff changeset
    10
#include <prototypes.h>
0fbbe329c3a2 demos/parser
Markus Bröker <mbroeker@largo.localnet>
parents:
diff changeset
    11
0fbbe329c3a2 demos/parser
Markus Bröker <mbroeker@largo.localnet>
parents:
diff changeset
    12
extern FILE *yyin;
0fbbe329c3a2 demos/parser
Markus Bröker <mbroeker@largo.localnet>
parents:
diff changeset
    13
0fbbe329c3a2 demos/parser
Markus Bröker <mbroeker@largo.localnet>
parents:
diff changeset
    14
void usage (char *cmd)
0fbbe329c3a2 demos/parser
Markus Bröker <mbroeker@largo.localnet>
parents:
diff changeset
    15
{
0fbbe329c3a2 demos/parser
Markus Bröker <mbroeker@largo.localnet>
parents:
diff changeset
    16
    printf ("Usage: %s <options> <source files>\n", cmd);
0fbbe329c3a2 demos/parser
Markus Bröker <mbroeker@largo.localnet>
parents:
diff changeset
    17
}
0fbbe329c3a2 demos/parser
Markus Bröker <mbroeker@largo.localnet>
parents:
diff changeset
    18
0fbbe329c3a2 demos/parser
Markus Bröker <mbroeker@largo.localnet>
parents:
diff changeset
    19
int main (int argc, char **argv)
0fbbe329c3a2 demos/parser
Markus Bröker <mbroeker@largo.localnet>
parents:
diff changeset
    20
{
0fbbe329c3a2 demos/parser
Markus Bröker <mbroeker@largo.localnet>
parents:
diff changeset
    21
    FILE *fp;
0fbbe329c3a2 demos/parser
Markus Bröker <mbroeker@largo.localnet>
parents:
diff changeset
    22
0fbbe329c3a2 demos/parser
Markus Bröker <mbroeker@largo.localnet>
parents:
diff changeset
    23
    if (argc < 2) {
0fbbe329c3a2 demos/parser
Markus Bröker <mbroeker@largo.localnet>
parents:
diff changeset
    24
        usage (argv[0]);
48
b94d657a9acb Policy Inonsistency on many files
Markus Bröker <mbroeker@largo.dyndns.tv>
parents: 37
diff changeset
    25
        return EXIT_FAILURE;
37
0fbbe329c3a2 demos/parser
Markus Bröker <mbroeker@largo.localnet>
parents:
diff changeset
    26
    }
0fbbe329c3a2 demos/parser
Markus Bröker <mbroeker@largo.localnet>
parents:
diff changeset
    27
0fbbe329c3a2 demos/parser
Markus Bröker <mbroeker@largo.localnet>
parents:
diff changeset
    28
    if ((fp = fopen (argv[1], "r")) == NULL) {
0fbbe329c3a2 demos/parser
Markus Bröker <mbroeker@largo.localnet>
parents:
diff changeset
    29
        perror ("FOPEN");
0fbbe329c3a2 demos/parser
Markus Bröker <mbroeker@largo.localnet>
parents:
diff changeset
    30
        return EXIT_FAILURE;
0fbbe329c3a2 demos/parser
Markus Bröker <mbroeker@largo.localnet>
parents:
diff changeset
    31
    }
0fbbe329c3a2 demos/parser
Markus Bröker <mbroeker@largo.localnet>
parents:
diff changeset
    32
0fbbe329c3a2 demos/parser
Markus Bröker <mbroeker@largo.localnet>
parents:
diff changeset
    33
    yyin = fp;
0fbbe329c3a2 demos/parser
Markus Bröker <mbroeker@largo.localnet>
parents:
diff changeset
    34
    yyparse ();
0fbbe329c3a2 demos/parser
Markus Bröker <mbroeker@largo.localnet>
parents:
diff changeset
    35
0fbbe329c3a2 demos/parser
Markus Bröker <mbroeker@largo.localnet>
parents:
diff changeset
    36
    fclose (fp);
0fbbe329c3a2 demos/parser
Markus Bröker <mbroeker@largo.localnet>
parents:
diff changeset
    37
0fbbe329c3a2 demos/parser
Markus Bröker <mbroeker@largo.localnet>
parents:
diff changeset
    38
    return EXIT_SUCCESS;
0fbbe329c3a2 demos/parser
Markus Bröker <mbroeker@largo.localnet>
parents:
diff changeset
    39
}