libtpcmisc
 All Data Structures Files Functions Variables Enumerator Defines
Functions
iftsrch.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
#include "include/ift.h"
#include "include/substitutions.h"
Include dependency graph for iftsrch.c:

Go to the source code of this file.

Functions

int iftGet (IFT *ift, char *key)
int iftGetNth (IFT *ift, char *key, int n)
int iftFindNthKey (IFT *ift, char *str, int n)
int iftFindNthValue (IFT *ift, char *str, int n)
int iftGetFrom (IFT *ift, int si, const char *key)
int iftGetFullmatchFrom (IFT *ift, int si, const char *key, const char *value)
int iftGetFloatValue (IFT *ift, int si, const char *key, float *value)
int iftGetIntValue (IFT *ift, int si, const char *key, int *value)

Function Documentation

int iftFindNthKey ( IFT ift,
char *  str,
int  n 
)

Find the Nth item of IFT where the specified string is found in the key. Comparison is case sensitive.

Parameters:
iftPointer to existing IFT
strPointer to the case-sensitive (partial) key string
nNth (1..keyNr-1) insidence of value is searched.
Returns:
-1 if key was not found, or other negative value in case of an error, and the index [0..keyNr-1] if matching key is found.

Definition at line 119 of file iftsrch.c.

References IFT_FAULT, IFT_KEYNOTFOUND, IFT_OK, IFT_TEST, iftSetStatus(), IFT::item, IFT_KEY_AND_VALUE::key, and IFT::keyNr.

Here is the call graph for this function:

int iftFindNthValue ( IFT ift,
char *  str,
int  n 
)

Find the Nth item of IFT where the specified string is found in the value. Comparison is case sensitive.

Parameters:
iftPointer to existing IFT
strPointer to the case-sensitive (partial) value string
nNth (1..keyNr-1) insidence of value is searched.
Returns:
-1 if key was not found, or other negative value in case of an error, and the index [0..keyNr-1] if matching value is found.

Definition at line 150 of file iftsrch.c.

References IFT_FAULT, IFT_OK, IFT_TEST, IFT_VALUENOTFOUND, iftSetStatus(), IFT::item, IFT::keyNr, and IFT_KEY_AND_VALUE::value.

Here is the call graph for this function:

int iftGet ( IFT ift,
char *  key 
)

Find the key in the IFT and return the index [0..keyNr-1]. Key is case insensitive.

Parameters:
iftPointer to existing IFT
keyPointer to the key string; contents are replaced by the correct key string
Returns:
-1 if key was not found, or other negative value in case of an error

Definition at line 58 of file iftsrch.c.

References IFT_FAULT, IFT_KEYNOTFOUND, IFT_OK, IFT_TEST, iftSetStatus(), IFT::item, IFT_KEY_AND_VALUE::key, and IFT::keyNr.

Here is the call graph for this function:

int iftGetFloatValue ( IFT ift,
int  si,
const char *  key,
float *  value 
)

Finds the specified key string from IFT struct, and reads the corresponding value as float.

Returns:
Returns the index of key/value, -1 if key or value was not found, and <-1 in case of an error.
Parameters:
iftPointer to existing IFT
siIndex [0..keyNr-1] from which the search is started
keyPointer to the key string; search is case-insensitive
valuePointer to float variable where value is written; NaN is written in case of an error.

Definition at line 244 of file iftsrch.c.

References IFT_FAULT, IFT_KEYNOTFOUND, IFT_OK, IFT_TEST, IFT_VALUENOTFOUND, iftSetStatus(), IFT::item, IFT_KEY_AND_VALUE::key, IFT::keyNr, and IFT_KEY_AND_VALUE::value.

Here is the call graph for this function:

int iftGetFrom ( IFT ift,
int  si,
const char *  key 
)

Finds the specified key in the IFT, starting from specified index. Key is case insensitive.

Returns:
Returns the index of key/value, -1 if key or value was not found, and <-1 in case of an error.
Parameters:
iftPointer to existing IFT
siIndex [0..keyNr-1] from which the search is started
keyPointer to the key string; search is case-insensitive

Definition at line 176 of file iftsrch.c.

References IFT_FAULT, IFT_KEYNOTFOUND, IFT_OK, IFT_TEST, iftSetStatus(), IFT::item, IFT_KEY_AND_VALUE::key, and IFT::keyNr.

Here is the call graph for this function:

int iftGetFullmatchFrom ( IFT ift,
int  si,
const char *  key,
const char *  value 
)

Finds the index with specified key and value in the IFT, starting from specified index. Key and value are case insensitive.

Returns:
Returns the index of key/value, -1 if key or value was not found, and <-1 in case of an error.
Parameters:
iftPointer to existing IFT
siIndex [0..keyNr-1] from which the search is started
keyPointer to the key string; search is case-insensitive
valuePointer to the value string; search is case-insensitive

Definition at line 208 of file iftsrch.c.

References IFT_FAULT, IFT_KEYNOTFOUND, IFT_OK, IFT_TEST, iftSetStatus(), IFT::item, IFT_KEY_AND_VALUE::key, IFT::keyNr, and IFT_KEY_AND_VALUE::value.

Here is the call graph for this function:

int iftGetIntValue ( IFT ift,
int  si,
const char *  key,
int *  value 
)

Finds the specified key string from IFT struct, and reads the corresponding value as int.

Returns:
Returns the index of key/value, -1 if key or value was not found, and <-1 in case of an error.
Parameters:
iftPointer to existing IFT
siIndex [0..keyNr-1] from which the search is started
keyPointer to the key string; search is case-insensitive
valuePointer to int variable where value is written; -9999 is written in case of an error.

Definition at line 284 of file iftsrch.c.

References IFT_FAULT, IFT_KEYNOTFOUND, IFT_OK, IFT_TEST, IFT_VALUENOTFOUND, iftSetStatus(), IFT::item, IFT_KEY_AND_VALUE::key, IFT::keyNr, and IFT_KEY_AND_VALUE::value.

Here is the call graph for this function:

int iftGetNth ( IFT ift,
char *  key,
int  n 
)

Find the Nth key with similar name in the IFT and return the index [0..keyNr-1]. Key is case insensitive.

Parameters:
iftPointer to existing IFT
keyPointer to the key string; contents are replaced by the correct key string
nNth (1..) insidence of key is searched.
Returns:
-1 if key was not found, or other negative value in case of an error

Definition at line 88 of file iftsrch.c.

References IFT_FAULT, IFT_KEYNOTFOUND, IFT_OK, IFT_TEST, iftSetStatus(), IFT::item, IFT_KEY_AND_VALUE::key, and IFT::keyNr.

Here is the call graph for this function: