#include "cstring.h"
#include "fmm.h"
#include "msgcat.h"
#include "ostream.h"
#include "tenapp.h"
#include "system.h"
#include "version.h"
#include "c_types.h"
#include "error.h"
#include "catalog.h"
#include "basetype.h"
#include "buffer.h"
#include "capsule.h"
#include "compile.h"
#include "constant.h"
#include "debug.h"
#include "declare.h"
#include "exception.h"
#include "file.h"
#include "dump.h"
#include "hash.h"
#include "initialise.h"
#include "instance.h"
#include "inttype.h"
#include "lex.h"
#include "literal.h"
#include "load.h"
#include "macro.h"
#include "namespace.h"
#include "operator.h"
#include "option.h"
#include "overload.h"
#include "parse.h"
#include "predict.h"
#include "preproc.h"
#include "printf.h"
#include "redeclare.h"
#include "statement.h"
#include "syntax.h"
#include "table.h"
#include "template.h"
#include "tok.h"
#include "tokdef.h"
#include "typeid.h"
#include "unmangle.h"
#include "ustring.h"
#include "variable.h"
/*
* DEFAULT MACHINE OPTION
*
* This macro is used to determine the machine dependent options to
* be used.
*/
#ifndef FS_MACHINE
#ifdef FS_DOS
#define FS_MACHINE "dos"
#else
#define FS_MACHINE "unix"
#endif
#endif
/*
* COMMAND-LINE FLAGS
*
* These flags may be set by command-line options to indicate various
* actions to the compiler.
*/
static int builtin_asserts = 1;
static int builtin_macros = 1;
static int check_level = 0;
static int complete_program = 0;
static int have_startup = 0;
static int spec_linker = 0;
static int started_scope = 0;
static int output_last = 1;
static int unmangle_names = 0;
static int quit_immediately = 0;
static string dump_name = NULL;
static string dump_opt = NULL;
static string spec_name = NULL;
static string table_name = NULL;
/*
* TABLE OF COMMAND-LINE ARGUMENTS
*
* This table describes all the command-line options. Each is given by
* an option letter, followed by a flag indicating whether the option can
* be split into two components, and a description of the second option
* component.
*/
typedef struct {
char opt;
char space;
const char *arg;
const char *desc;
} PROGRAM_ARG;
static PROGRAM_ARG prog_args [] = {
{ 'A', 1, "()", "assert a predicate" },
{ 'D', 1, "=", "define a macro" },
{ 'E', 0, NULL, "preprocess input file only" },
{ 'F', 1, "", "read list of options from file" },
{ 'H', 0, NULL, "report file inclusions" },
{ 'I', 1, "", "specify an include directory" },
{ 'M', 1, "", "machine dependent options" },
{ 'N', 1, ":", "specify a named include directory" },
{ 'O', 0, NULL, "optimise output capsule" },
{ 'Q', 0, NULL, "quit immediately" },
{ 'R', 0, NULL, "reverse order of files" },
{ 'S', 0, NULL, "spec file linker action" },
{ 'U', 1, "", "undefine a macro" },
{ 'V', 0, NULL, "print version number" },
{ 'W', 1, "", "enable warnings option" },
{ 'X', 0, NULL, "disable exception handling" },
{ 'Z', 1, "", "set maximum number of errors" },
{ 'a', 0, NULL, "apply complete program checks" },
{ 'c', 0, NULL, "disable TDF output" },
{ 'd', 1, "=", "dump symbol table" },
{ 'e', 1, "", "add an end-up file" },
{ 'f', 1, "", "add a start-up file" },
{ 'g', 0, "", "enable diagnostics mode" },
{ 'h', 0, NULL, "print this help page" },
{ 'i', 1, "", "print dependencies for make" },
{ 'j', 1, "", "set TDF output options" },
{ 'm', 1, "", "set error printing options" },
{ 'n', 1, "", "specify portability table" },
{ 'o', 1, "