#include <stdio.h>#include <stdlib.h>#include <string.h>#include <ctype.h>#include "include/ift.h"#include "include/substitutions.h"Go to the source code of this file.
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) |
| int | iftdup (IFT *ift1, IFT *ift2) |
Variables | |
| static const 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 |
Definition at line 182 of file ift.c.
References IFT_FAULT, IFT_OK, 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.
Make a copy (duplicate) of IFT struct.
| ift1 | Pointer to IFT struct to be copied |
| ift2 | Pointer to initiated IFT struct; any previous contents are deleted. |
Definition at line 237 of file ift.c.
References IFT_FAULT, IFT_OK, IFT_TEST, iftEmpty(), iftPut(), IFT::item, IFT_KEY_AND_VALUE::key, IFT::keyNr, IFT::status, IFT_KEY_AND_VALUE::sw, IFT_KEY_AND_VALUE::type, IFT::type, and IFT_KEY_AND_VALUE::value.
Free memory allocated for IFT. All contents are destroyed.
| ift | target IFT structure |
Definition at line 104 of file ift.c.
References IFT::_memNr, IFT::data, IFT::datasize, IFT_TEST, IFT::item, IFT_KEY_AND_VALUE::key, IFT::keyNr, and IFT_KEY_AND_VALUE::value.
Initiate IFT structure. This should be called once before first use.
| ift | target ift structure |
Definition at line 90 of file ift.c.
References IFT::_memNr, IFT::data, IFT::datasize, IFT_TEST, IFT::item, and IFT::keyNr.
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) |
Definition at line 130 of file ift.c.
References IFT::_memNr, IFT_FAULT, IFT_NOMEMORY, IFT_OK, 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 defRead(), iftdup(), and 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) |
Definition at line 215 of file ift.c.
References IFT_FAULT, IFT_NOMEMORY, IFT_OK, 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 |
Definition at line 78 of file ift.c.
References IFT_FAULT, ift_status, and IFT::status.
Referenced by defRead(), iftDeleteItem(), iftFindNthKey(), iftFindNthValue(), iftGet(), iftGetFloatValue(), iftGetFrom(), iftGetFullmatchFrom(), iftGetIntValue(), iftGetNth(), iftPut(), iftRead(), iftReplaceNthValue(), iftWrite(), and iftWriteItem().
const char* ift_status[] [static] |
{
"ok",
"fault in calling routine",
"out of memory",
"cannot open file",
"cannot write file",
"unsupported file type",
"key not found",
"file contains no data",
"value not found",
0
}
Definition at line 56 of file ift.c.
Referenced by iftSetStatus().
1.8.0