Alien-LibJIT

 view release on metacpan or  search on metacpan

libjit/dpas/dpas-main.c  view on Meta::CPAN

/*
 * dpas-main.c - Main entry point for the Dyanmic Pascal Compiler.
 *
 * Copyright (C) 2004  Southern Storm Software, Pty Ltd.
 *
 * This file is part of the libjit library.
 *
 * The libjit library 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 2.1 of
 * the License, or (at your option) any later version.
 *
 * The libjit library 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 the libjit library.  If not, see
 * <http://www.gnu.org/licenses/>.
 */

#include "dpas-internal.h"
#include <config.h>
#include <stdlib.h>

/*
 * Command-line options.
 */
static char *progname = 0;
static char *filename = 0;
static char **include_dirs = 0;
static int num_include_dirs = 0;
static char **using_seen = 0;
static int num_using_seen = 0;
static int dont_fold = 0;

/*
 * Forward declarations.
 */
static void version(void);
static void usage(void);
static void add_include_dir(char *dir);
static void initialize(void);

int main(int argc, char **argv)
{
	FILE *file;

	/* Parse the command-line options */
	progname = argv[0];
	while(argc > 1 && argv[1][0] == '-' && argv[1][1] != '\0')
	{
		if(!jit_strncmp(argv[1], "-I", 2))
		{
			if(argv[1][2] == '\0')
			{
				++argv;
				--argc;
				if(argc > 1)
				{
					add_include_dir(argv[1]);
				}
				else
				{
					usage();
				}
			}
			else
			{
				add_include_dir(argv[1] + 2);
			}
		}
		else if(!jit_strcmp(argv[1], "-v") ||
		        !jit_strcmp(argv[1], "--version"))
		{
			version();
		}
		else if(!jit_strcmp(argv[1], "-d"))
		{



( run in 0.485 second using v1.01-cache-2.11-cpan-df04353d9ac )