SRC/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 (IN int argc, IN char **argv, OUT t_options *Options)

Typedef Documentation

typedef struct s_options t_options

Definition at line 1 of file ReadOptions.h.


Function Documentation

void ReadOptions ( IN int  argc,
IN char **  argv,
OUT t_options Options 
)

Definition at line 44 of file ReadOptions.c.

00047 {
00048     char **Args, **head;
00049 
00050     /* Clear values and pointers to zero */
00051     memset(Options, 0, sizeof(t_options));
00052 
00053     /* Alloc a new pointer list for args with a NULL at end.
00054      * This makes parsing the same as for archfile for consistency.
00055      * Skips the first arg as it is the program image path */
00056     --argc;
00057     ++argv;
00058     head = Args = (char **)my_malloc(sizeof(char *) * (argc + 1));
00059     memcpy(Args, argv, (sizeof(char *) * argc));
00060     Args[argc] = NULL;
00061 
00062     /* Go through the command line args. If they have hyphens they are 
00063      * options. Otherwise assume they are part of the four mandatory
00064      * arguments */
00065     while(*Args)
00066         {
00067             if(strncmp("--", *Args, 2) == 0)
00068                 {
00069                     *Args += 2; /* Skip the prefix */
00070                     Args =
00071                         (char **)ProcessOption((const char *const *)Args,
00072                                                Options);
00073                 }
00074             else if(strncmp("-", *Args, 1) == 0)
00075                 {
00076                     *Args += 1; /* Skip the prefix */
00077                     Args =
00078                         (char **)ProcessOption((const char *const *)Args,
00079                                                Options);
00080                 }
00081             else if(NULL == Options->NetFile)
00082                 {
00083                     Options->NetFile = my_strdup(*Args);
00084                     ++Args;
00085                 }
00086             else if(NULL == Options->ArchFile)
00087                 {
00088                     Options->ArchFile = my_strdup(*Args);
00089                     ++Args;
00090                 }
00091             else if(NULL == Options->PlaceFile)
00092                 {
00093                     Options->PlaceFile = my_strdup(*Args);
00094                     ++Args;
00095                 }
00096             else if(NULL == Options->RouteFile)
00097                 {
00098                     Options->RouteFile = my_strdup(*Args);
00099                     ++Args;
00100                 }
00101             else
00102                 {
00103                     /* Not an option and arch and net already specified so fail */
00104                     Error(*Args);
00105                 }
00106         }
00107         free(head);
00108 }

Here is the call graph for this function:

Here is the caller graph for this function:


Generated on Tue Jan 5 15:26:04 2010 for VPR5.0 by  doxygen 1.6.1