This file is indexed.

/usr/bin/ffc is in python-ffc 1.6.0-2.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  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
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
#! /usr/bin/python

# This script is the command-line interface to FFC. It parses
# command-line arguments and wraps the given form file code in a
# Python module which is then executed.

# Copyright (C) 2004-2014 Anders Logg
#
# This file is part of FFC.
#
# FFC is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# FFC is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with FFC. If not, see <http://www.gnu.org/licenses/>.
#
# Modified by Johan Jansson, 2005.
# Modified by Ola Skavhaug, 2006.
# Modified by Dag Lindbo, 2008.
# Modified by Kristian B. Oelgaard 2010.

# Python modules.
import sys
import getopt
import cProfile
import re
import string
import os
from os import curdir
from os import path
from os import getcwd

# UFL modules.
from ufl.log import UFLException
from ufl.algorithms import load_ufl_file
import ufl

# FFC modules.
from ffc.log import info
from ffc.log import set_level
from ffc.log import DEBUG
from ffc.log import ERROR
from ffc.parameters import default_parameters
from ffc import __version__ as FFC_VERSION
from ffc.compiler import compile_form, compile_element
from ffc.errorcontrol import compile_with_error_control

def error(msg):
    "Print error message (cannot use log system at top level)."
    print("\n".join(["*** FFC: " + line for line in msg.split("\n")]))

def info_version():
    "Print version number."
    info("""\
This is FFC, the FEniCS Form Compiler, version {0}.
For further information, visit http://www.fenics.org/ffc/.
""".format(FFC_VERSION))

def info_usage():
    "Print usage information."
    info_version()
    info("""Usage: ffc [OPTION]... input.form

For information about the FFC command-line interface, refer to
the FFC man page which may invoked by 'man ffc' (if installed).
""")

def main(argv):
    "Main function."

    # Append current directory to path, such that the *_debug module created by
    # ufl_load_file can be found when FFC  compiles a form which is not in the
    # PYHTONPATH
    sys.path.append(getcwd())

    # Get parameters and set log level (such that info_usage() will work)
    parameters = default_parameters()
    set_level(parameters["log_level"])

    # Get command-line arguments
    try:
        opts, args = getopt.getopt(argv, \
        "hVvsl:r:f:Oo:q:ep", \
        ["help", "version", "verbose", "silent", "language=", "representation=",
         "optimize", "output-directory=", "quadrature-rule=", "error-control", "profile"])
    except getopt.GetoptError:
        info_usage()
        error("Illegal command-line arguments.")
        return 1

    # Check for --help
    if ("-h", "") in opts or ("--help", "") in opts:
        info_usage()
        return 0

    # Check for --version
    if ("-V", "") in opts or ("--version", "") in opts:
        info_version()
        return 0

    # Check that we get at least one file
    if len(args) == 0:
        error("Missing file.")
        return 1

    # Parse command-line parameters
    for opt, arg in opts:
        if opt in ("-v", "--verbose"):
             parameters["log_level"] = DEBUG
        elif opt in ("-s", "--silent"):
            parameters["log_level"] = ERROR
        elif opt in ("-l", "--language"):
            parameters["format"] = arg
        elif opt in ("-r", "--representation"):
            parameters["representation"] = arg
        elif opt in ("-q", "--quadrature-rule"):
            parameters["quadrature_rule"] = arg
        elif opt == "-f":
            if len(arg.split("=")) == 2:
                (key, value) = arg.split("=")
                parameters[key] = value
            elif len(arg.split("==")) == 1:
                key = arg.split("=")[0]
                parameters[arg] = True
            else:
                info_usage()
                return 1
        elif opt in ("-O", "--optimize"):
            parameters["optimize"] = True
        elif opt in ("-o", "--output-directory"):
            parameters["output_dir"] = arg
        elif opt in ("-e", "--error-control"):
            parameters["error_control"] = True
        elif opt in ("-p", "--profile"):
            parameters["profile"] = True

    # Set log_level again in case -d or -s was used on the command line
    set_level(parameters["log_level"])

    # Set UFL precision
    ufl.constantvalue.precision = int(parameters["precision"])

    # Print a nice message
    info_version()

    # Call parser and compiler for each file
    for filename in args:

        # Get filename prefix and suffix
        prefix, suffix = os.path.splitext(os.path.basename(filename))
        suffix = suffix.replace(os.path.extsep, "")
        # Remove weird characters (file system allows more than the C preprocessor)
        prefix = re.subn("[^{}]".format(string.ascii_letters + string.digits + "_"), "!", prefix)[0]
        prefix = re.subn("!+", "_", prefix)[0]

        # Turn on profiling
        if parameters.get("profile"):
            pr = cProfile.Profile()
            pr.enable()

        # Check file suffix and load ufl file
        if suffix == "ufl":
            ufd = load_ufl_file(filename)
        elif suffix == "form":
            error("Old style .form files are no longer supported. Use form2ufl to convert to UFL format.")
            return 1
        else:
            error("Expecting a UFL form file (.ufl).")
            return 1

        # Do additional stuff if in error-control mode
        if parameters["error_control"]:
            return compile_with_error_control(ufd.forms, ufd.object_names,
                                              ufd.reserved_objects, prefix,
                                              parameters)

        # Catch exceptions only when not in debug mode
        if parameters["log_level"] <= DEBUG:
            if len(ufd.forms) > 0:
                compile_form(ufd.forms, ufd.object_names, prefix, parameters)
            else:
                compile_element(ufd.elements, prefix, parameters)
        else:
            try:
                if len(ufd.forms) > 0:
                    compile_form(ufd.forms, ufd.object_names, prefix, parameters)
                else:
                    compile_element(ufd.elements, prefix, parameters)
            except Exception as exception:
                info("")
                error(str(exception))
                error("To get more information about this error, rerun FFC with --verbose.")
                return 1

        # Turn off profiling and write status to file
        if parameters.get("profile"):
            pr.disable()
            pfn = "ffc_{0}.profile".format(prefix)
            pr.dump_stats(pfn)
            info("Wrote profiling info to file {0}".format(pfn))
            #pr.print_stats()

    return 0

if __name__ == "__main__":
    sys.exit(main(sys.argv[1:]))