VPR-6.0

vpr/SRC/base/ReadOptions.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  s_options

Typedefs

typedef struct s_options t_options

Functions

void ReadOptions (INP int argc, INP char **argv, OUTP t_options *Options)

Typedef Documentation

typedef struct s_options t_options

Definition at line 4 of file ReadOptions.h.


Function Documentation

void ReadOptions ( INP int  argc,
INP char **  argv,
OUTP t_options Options 
)

Definition at line 49 of file ReadOptions.c.

{
    char **Args, **head;

    /* Clear values and pointers to zero */
    memset(Options, 0, sizeof(t_options));

    /* Alloc a new pointer list for args with a NULL at end.
     * This makes parsing the same as for archfile for consistency.
     * Skips the first arg as it is the program image path */
    --argc;
    ++argv;
    head = Args = (char **)my_malloc(sizeof(char *) * (argc + 1));
    memcpy(Args, argv, (sizeof(char *) * argc));
    Args[argc] = NULL;

    /* Go through the command line args. If they have hyphens they are 
     * options. Otherwise assume they are part of the four mandatory
     * arguments */
    while(*Args)
        {
            if(strncmp("--", *Args, 2) == 0)
                {
                    *Args += 2; /* Skip the prefix */
                    Args =
                        (char **)ProcessOption((const char *const *)Args,
                                               Options);
                }
            else if(strncmp("-", *Args, 1) == 0)
                {
                    *Args += 1; /* Skip the prefix */
                    Args =
                        (char **)ProcessOption((const char *const *)Args,
                                               Options);
                }
                else if(NULL == Options->ArchFile)
                {
                    Options->ArchFile = my_strdup(*Args);
                    ++Args;
                }
            else if(NULL == Options->CircuitName)
                {
                        Options->CircuitName = my_strdup(*Args);
                    ++Args;
                }
            else
                {
                    /* Not an option and arch and net already specified so fail */
                    Error(*Args);
                }
        }
        free(head);
}

Here is the call graph for this function:

Here is the caller graph for this function: