My Project
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "include/ift.h"
#include "include/substitutions.h"
Functions | |
void | iftSetStatus (IFT *ift, int status) |
void | iftInit (IFT *ift) |
void | iftEmpty (IFT *ift) |
int | iftPut (IFT *ift, char *key, char *value, char *cmt_type) |
int | iftDeleteItem (IFT *ift, int item) |
int | iftReplaceNthValue (IFT *ift, int item, char *value) |
Variables | |
static char * | ift_status [] |
int iftDeleteItem | ( | IFT * | ift, |
int | item | ||
) |
Remove the specified item from IFT.
ift | Pointer to existing IFT |
item | Index [0..keyNr-1] of key and value to delete |
References IFT_TEST, iftSetStatus(), IFT::item, IFT_KEY_AND_VALUE::key, IFT::keyNr, IFT_KEY_AND_VALUE::sw, IFT_KEY_AND_VALUE::type, and IFT_KEY_AND_VALUE::value.
void iftEmpty | ( | IFT * | ift | ) |
Free memory allocated for IFT. All contents are destroyed.
ift | target IFT structure |
References IFT::_memNr, IFT::data, IFT::datasize, IFT_TEST, IFT::item, IFT_KEY_AND_VALUE::key, IFT::keyNr, and IFT_KEY_AND_VALUE::value.
Referenced by iftRead().
void iftInit | ( | IFT * | ift | ) |
Initiate IFT structure. This should be called once before first use.
ift | target ift structure |
References IFT::_memNr, IFT::data, IFT::datasize, IFT_TEST, IFT::item, and IFT::keyNr.
int iftPut | ( | IFT * | ift, |
char * | key, | ||
char * | value, | ||
char * | cmt_type | ||
) |
Add specified key and its value to the IFT. Also comment type (first character pointed to) can be added. Either key or value can be empty, but not both of them.
ift | Pointer to initiated IFT |
key | Key string; can be empty ("" or NULL) |
value | Value string; can be empty ("" or NULL) |
cmt_type | Pointer to comment character, e.g. '#' or ';' or '!' can be empty ("" or NULL) |
References IFT::_memNr, IFT_TEST, iftSetStatus(), IFT::item, IFT_KEY_AND_VALUE::key, IFT::keyNr, IFT_KEY_AND_VALUE::sw, IFT_KEY_AND_VALUE::type, and IFT_KEY_AND_VALUE::value.
Referenced by iftRead().
int iftReplaceNthValue | ( | IFT * | ift, |
int | item, | ||
char * | value | ||
) |
Replaces specified value in IFT with a new value.
ift | Pointer to initiated IFT |
item | Index [0..keyNr-1] of key and value |
value | Value string; can be empty ("" or NULL) |
References IFT_TEST, iftSetStatus(), IFT::item, IFT::keyNr, and IFT_KEY_AND_VALUE::value.
void iftSetStatus | ( | IFT * | ift, |
int | status | ||
) |
Sets IFT status
ift | target IFT structure |
status | new status value |
References ift_status, and IFT::status.
Referenced by iftDeleteItem(), iftFindNthKey(), iftFindNthValue(), iftGet(), iftGetNth(), iftPut(), iftRead(), iftReplaceNthValue(), iftWrite(), and iftWriteItem().
|
static |
Referenced by iftSetStatus().