15 # define FORTRAN_NAME(low,up) up
18 # define FORTRAN_NAME(low,up) low##_
20 # define FORTRAN_NAME(low,up) low
26 #define finiparser_dump FORTRAN_NAME(finiparser_dump, FINIPARSER_DUMP)
27 #define finiparser_getPair FORTRAN_NAME(finiparser_getpair, FINIPARSER_GETPAIR)
28 #define finiparser_load FORTRAN_NAME(finiparser_load, FINIPARSER_LOAD)
29 #define finiparser_free FORTRAN_NAME(finiparser_free, FINIPARSER_FREE)
30 #define finiparser_getString FORTRAN_NAME(finiparser_getstring, FINIPARSER_GETSTRING)
31 #define finiparser_getDictEntries FORTRAN_NAME(finiparser_getdictentries, FINIPARSER_GETDICTENTRIES)
32 #define finiparser_getBool FORTRAN_NAME(finiparser_getbool, FINIPARSER_GETBOOL)
33 #define finiparser_find FORTRAN_NAME(finiparser_find, FINIPARSER_FIND)
34 #define finiparser_getDbl FORTRAN_NAME(finiparser_getdbl, FINIPARSER_GETDBL)
35 #define finiparser_getToken FORTRAN_NAME(finiparser_gettoken, FINIPARSER_GETTOKEN)
36 #define finiparser_findTokens FORTRAN_NAME(finiparser_findtokens, FINIPARSER_FINDTOKENS)
50 if (str <= (
char *) 0) {
53 for (i=str_len-1; i>=0; i--)
if (str[i] !=
' ')
break;
59 newstr = (
char *) malloc((real_len+1)*
sizeof(char));
60 strncpy(newstr, str, real_len);
61 newstr[real_len] =
'\0';
101 if (*
id > dic->
n)
return;
102 for (i=0; i<key_len; i++) key[i] =
' ';
103 for (i=0; i<val_len; i++) val[i] =
' ';
105 real_key_len = strlen(dic->
key[*
id-1]);
106 if(dic->
val[*
id-1] != NULL) real_val_len = strlen(dic->
val[*
id-1]);
108 if(real_key_len > key_len)
return;
109 if(real_val_len > val_len)
return;
111 strncpy(key,dic->
key[*
id-1],real_key_len);
112 strncpy(val,dic->
val[*
id-1],real_val_len);
125 if (dic == NULL) *ierr = 1;
144 for (i=0; i<out_len; i++) out[i] =
' ';
149 real_out_len = strlen(str);
150 if(real_out_len <= out_len) {
151 strncpy(out,str,real_out_len);
195 for (i=0; i<out_len; i++) out[i] =
' ';
197 real_out_len = strlen(token[*
id-1]);
198 if(real_out_len <= out_len) strncpy(out,token[*
id-1],real_out_len);
215 if (str == NULL)
return;
217 newstr = (
char *) malloc((strlen(str)+1)*
sizeof(char));
218 strncpy(newstr,str,strlen(str)+1);
221 token[i] = strtok(newstr,d);
222 while (token[i] != NULL && i <=
ntokenmax-1) {
224 token[++i] = strtok(NULL,d);
void dictionary_del(dictionary *d)
Delete a dictionary object.
#define finiparser_getBool
#define finiparser_getDictEntries
#define finiparser_getDbl
char * addchar0(char *str, int str_len)
#define finiparser_getString
#define finiparser_getPair
#define finiparser_getToken
#define finiparser_findTokens
void iniparser_dump(const dictionary *d, FILE *f)
Dump a dictionary to an opened file pointer.
unsigned strstrip(char *s)
Remove blanks at the beginning and the end of a string.
dictionary * iniparser_load(const char *ininame)
Parse an ini file and return an allocated dictionary object.
int iniparser_find_entry(const dictionary *ini, const char *entry)
Finds out if a given entry exists in a dictionary.
const char * iniparser_getstring(const dictionary *d, const char *key, const char *def)
Get the string associated to a key.
int iniparser_getboolean(const dictionary *d, const char *key, int notfound)
Get the string associated to a key, convert to a boolean.