pmm  1.0.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
Functions
pmm_argparser.c File Reference

Parsing command line arguments. More...

#include <stdio.h>
#include <stdlib.h>
#include <getopt.h>
#include <string.h>
#include "pmm_argparser.h"
#include "pmm_model.h"
#include "pmm_log.h"

Go to the source code of this file.

Functions

int parse_slice_str (char *slice_str, struct pmm_view_options *options)
int count_tokens_in_str (char *str, char *delimiters)
void usage ()
void parse_args (struct pmm_config *cfg, int argc, char **argv)
void usage_pmm_view ()
int parse_pmm_view_args (struct pmm_view_options *options, int argc, char **argv)

Detailed Description

Parsing command line arguments.

This file contains the command line argument parsing code for the pmm daemon and the pmm_view utility

Definition in file pmm_argparser.c.

Function Documentation

int count_tokens_in_str ( char *  str,
char *  delimiters 
)

Count the number of tokens in a atring seperated by a delimiter

Parameters
strpointer to the string
delimiterspointer to a string listing the delimiters
Returns
number of tokens or -1 on error
Warning
Not thread safe.

Definition at line 420 of file pmm_argparser.c.

void parse_args ( struct pmm_config cfg,
int  argc,
char **  argv 
)

Parse arguments for pmm building daemon.

Parameters
cfgpointer to config structure
argcnumber of command line arguments
argvpointer to command line arguments (array of character arrays)

Definition at line 73 of file pmm_argparser.c.

int parse_pmm_view_args ( struct pmm_view_options options,
int  argc,
char **  argv 
)

Parse arguments for pmm_view tool

Parameters
optionspointer to pmm_view options structure
argcnumber of command line arguments
argvpointer to command line arguments (array of character arrays)
Returns
0 on successful parsing, -1 on error

Definition at line 172 of file pmm_argparser.c.

int parse_slice_str ( char *  slice_str,
struct pmm_view_options options 
)

Parse the slice string into a arrays of parameter index and parameter value of a pmm_view_options structure.

The slice string format is a comma seperated list of pairs. Each pair is seperated by a colon. The first element of the pair describes a parameter index in the form pN, where N is a number. The second element of the pair is either min, max or a integer value, describing the value that parameter should be fixed at.

To specify a slice all but 1 or 2 parameters must have their values fixed as specified by the string. If 1 parameter is left free the model will be a 2d plot, if 2 parameters are left free the plot will be a 3d surface.

Parameters
slice_strpointer to the slice string
optionspointer to the pmm_view_options structure
Returns
0 on success, -1 on failure
Warning
Not thread safe.

Definition at line 470 of file pmm_argparser.c.

void usage ( )

print command line usage for pmm building daemon

Definition at line 52 of file pmm_argparser.c.

void usage_pmm_view ( )

print command line usage for pmm_view tool

Definition at line 136 of file pmm_argparser.c.