5#include "tpcclibConfig.h"
44 for(i=0; i<ift->
_memNr; i++) {
79 if((key==NULL || strlen(key)<1) && (value==NULL || strlen(value)<1))
return TPCERROR_FAIL;
80 int verbose=0;
if(status!=NULL) verbose=status->
verbose;
82 printf(
"iftPut(ift, ");
83 if(key!=NULL) printf(
"\"%s\", ", key);
else printf(
"NULL, ");
84 if(value!=NULL) printf(
"\"%s\", ", value);
else printf(
"NULL, ");
85 printf(
"%d)\n", comment);
97 for(i=ift->
_memNr; i<ift->_memNr+add_nr; i++) {
99 ift->
item[i].
sw=(
short int)0;
143 sprintf(dstr,
"%g", value);
144 return(
iftPut(ift, key, dstr, comment, status));
169 sprintf(dstr,
"%d", value);
170 return(
iftPut(ift, key, dstr, comment, status));
186 const unsigned int value,
195 sprintf(dstr,
"%u", value);
196 return(
iftPut(ift, key, dstr, comment, status));
218 for(
int i=index+1; i<ift->
keyNr; i++) {
251 for(
int i=0; i<ift1->
keyNr; i++) {
280 int verbose=0;
if(status!=NULL) verbose=status->
verbose-1;
282 printf(
"iftReplaceValue(ift, %d", i);
283 if(value!=NULL) printf(
"\"%s\")\n", value);
else printf(
"NULL)\n");
319 int verbose=0;
if(status!=NULL) verbose=status->
verbose-1;
321 printf(
"iftReplaceKey(ift, %d", i);
322 if(key!=NULL) printf(
"\"%s\")\n", key);
else printf(
"NULL)\n");
356 int verbose=0;
if(status!=NULL) verbose=status->
verbose-1;
357 if(verbose>0) printf(
"%s()\n", __func__);
365 while(i<ift->keyNr-1) {
367 while(j<ift->keyNr) {
394 int is_value_required,
399 int is_comment_accepted,
405 int verbose=0;
if(status!=NULL) verbose=status->
verbose-1;
407 printf(
"%s(*ift1, *ift2, %d, %d, %d, status)\n", __func__,
408 is_key_required, is_value_required, is_comment_accepted);
409 if(ift2==NULL || ift2->
keyNr<1) {
416 for(
int i=0; i<ift2->
keyNr; i++) {
417 if(is_key_required && (ift2->
item[i].
key==NULL || strlen(ift2->
item[i].
key)<1))
continue;
418 if(is_value_required && (ift2->
item[i].
value==NULL || strlen(ift2->
item[i].
value)<1))
continue;
419 if(ift2->
item[i].
comment!=0 && is_comment_accepted==0)
continue;
420 if(ift2->
item[i].
comment==0 && is_comment_accepted==2)
continue;
425 if(verbose>1) printf(
" %d item(s) copied.\n", n);
int iftPutInt(IFT *ift, const char *key, const int value, char comment, TPCSTATUS *status)
int iftPutUInt(IFT *ift, const char *key, const unsigned int value, char comment, TPCSTATUS *status)
int iftReplaceValue(IFT *ift, int i, const char *value, TPCSTATUS *status)
int iftCopyItems(IFT *ift1, IFT *ift2, int is_key_required, int is_value_required, int is_comment_accepted, TPCSTATUS *status)
int iftPut(IFT *ift, const char *key, const char *value, char comment, TPCSTATUS *status)
int iftReplaceKey(IFT *ift, int i, const char *key, TPCSTATUS *status)
int iftDeleteDuplicateKeys(IFT *ift, TPCSTATUS *status)
int iftPutDouble(IFT *ift, const char *key, const double value, char comment, TPCSTATUS *status)
int iftDelete(IFT *ift, int index)
int iftDuplicate(IFT *ift1, IFT *ift2)
int iftFindKey(IFT *ift, const char *key, int start_index)
void statusSet(TPCSTATUS *s, const char *func, const char *srcfile, int srcline, tpcerror error)
char * strdup(const char *s)
int verbose
Verbose level, used by statusPrint() etc.
tpcerror error
Error code.
@ TPCERROR_FAIL
General error.
@ TPCERROR_OUT_OF_MEMORY
Cannot allocate memory.
@ TPCERROR_NO_KEY
Key not found.
Header file for library libtpcift.