Skip to content
Snippets Groups Projects
Commit 13428231 authored by Vesa Oikonen's avatar Vesa Oikonen
Browse files

code style

parent 64722eb1
No related branches found
No related tags found
No related merge requests found
...@@ -57,7 +57,7 @@ static const char *par_fn_ext[] = { ...@@ -57,7 +57,7 @@ static const char *par_fn_ext[] = {
@author Vesa Oikonen @author Vesa Oikonen
*/ */
char *parFormattxt( char *parFormattxt(
/** PAR format code */ /** PAR format code. */
parformat c parformat c
) { ) {
if(c<PAR_FORMAT_UNKNOWN || c>=PAR_FORMAT_LAST) return NULL; if(c<PAR_FORMAT_UNKNOWN || c>=PAR_FORMAT_LAST) return NULL;
...@@ -125,8 +125,7 @@ int parFormatFromExtension( ...@@ -125,8 +125,7 @@ int parFormatFromExtension(
/*****************************************************************************/ /*****************************************************************************/
/*****************************************************************************/ /*****************************************************************************/
/** Return pointer to default PAR file name extension, including the dot, /** Return pointer to default PAR file name extension, including the dot, based on the PAR format code.
based on the PAR format code.
@return pointer to the file name extension string. @return pointer to the file name extension string.
@sa parformat, parFormatFromExtension, parFormattxt, parWrite @sa parformat, parFormatFromExtension, parFormattxt, parWrite
@author Vesa Oikonen @author Vesa Oikonen
...@@ -151,8 +150,8 @@ int parWrite( ...@@ -151,8 +150,8 @@ int parWrite(
PAR *par, PAR *par,
/** Output file pointer. */ /** Output file pointer. */
FILE *fp, FILE *fp,
/** File format code; enter PAR_FORMAT_UNKNOWN (0) /** File format code; enter PAR_FORMAT_UNKNOWN (0) to write data in the format specified inside
to write data in the format specified inside PAR struct. */ the PAR struct. */
parformat format, parformat format,
/** Write (1) or do not write (0) also extra header fields found in PAR; /** Write (1) or do not write (0) also extra header fields found in PAR;
only effective with CSV formats. */ only effective with CSV formats. */
...@@ -236,7 +235,7 @@ int parRead( ...@@ -236,7 +235,7 @@ int parRead(
PAR *par, PAR *par,
/** Pointer to the file name; this string is not modified. */ /** Pointer to the file name; this string is not modified. */
const char *fname, const char *fname,
/** Pointer to status data; enter NULL if not needed */ /** Pointer to status data; enter NULL if not needed. */
TPCSTATUS *status TPCSTATUS *status
) { ) {
int verbose=0; if(status!=NULL) verbose=status->verbose; int verbose=0; if(status!=NULL) verbose=status->verbose;
...@@ -353,8 +352,7 @@ int parRead( ...@@ -353,8 +352,7 @@ int parRead(
IFT hdr; iftInit(&hdr); IFT hdr; iftInit(&hdr);
iftRead(&hdr, fp, 1, 1, status); fclose(fp); iftRead(&hdr, fp, 1, 1, status); fclose(fp);
if(hdr.keyNr>0) { if(hdr.keyNr>0) {
if(!strcasecmp(hdr.item[0].key, "content") && if(!strcasecmp(hdr.item[0].key, "content") && !strcasecmp(hdr.item[0].value, "parameters"))
!strcasecmp(hdr.item[0].value, "parameters"))
format=PAR_FORMAT_IFT; format=PAR_FORMAT_IFT;
} }
if(format==PAR_FORMAT_IFT) { if(format==PAR_FORMAT_IFT) {
...@@ -480,15 +478,14 @@ int parWriteLimits( ...@@ -480,15 +478,14 @@ int parWriteLimits(
/*****************************************************************************/ /*****************************************************************************/
/*****************************************************************************/ /*****************************************************************************/
/** Read the specified file and try to find constraints and tolerance for parameters /** Read the specified file and try to find constraints and tolerance for parameters listed in PAR structure.
listed in PAR structure.
@return enum tpcerror (TPCERROR_OK when successful). @return enum tpcerror (TPCERROR_OK when successful).
@author Vesa Oikonen @author Vesa Oikonen
@sa parWriteLimits, parWrite, parFree @sa parWriteLimits, parWrite, parFree
*/ */
int parReadLimits( int parReadLimits(
/** Pointer to PAR structure, into which the limits are saved. This must also /** Pointer to PAR structure, into which the limits are saved. This must also list the parameter
list the parameter names that are searched for from the file. */ names that are searched for from the file. */
PAR *par, PAR *par,
/** Input file name. */ /** Input file name. */
const char *fname, const char *fname,
......
...@@ -256,14 +256,12 @@ int main(int argc, char **argv) ...@@ -256,14 +256,12 @@ int main(int argc, char **argv)
} }
/* /*
* If target file does not exist, then save the selected contents in file, * If target file does not exist, then save the selected contents in file, and quit.
* and quit.
*/ */
if(newfile) { if(newfile) {
if(drymode) { if(drymode) {
printf("%d parameter(s) and %d TAC(s) would be written in %s\n", printf("%d parameter(s) and %d TAC(s) would be written in %s\n", parNr, tacNr, parfile1);
parNr, tacNr, parfile1);
parFree(&par1); parFree(&par2); parFree(&par1); parFree(&par2);
return(0); return(0);
} }
...@@ -288,8 +286,8 @@ int main(int argc, char **argv) ...@@ -288,8 +286,8 @@ int main(int argc, char **argv)
/* /*
* We are here only if target file exists. * We are here only if target file exists.
* Read the previous contents.
*/ */
/* Read the previous contents. */
if(verbose>1) printf("reading %s\n", parfile1); if(verbose>1) printf("reading %s\n", parfile1);
ret=parRead(&par1, parfile1, &status); ret=parRead(&par1, parfile1, &status);
if(ret!=TPCERROR_OK) { if(ret!=TPCERROR_OK) {
...@@ -366,8 +364,7 @@ int main(int argc, char **argv) ...@@ -366,8 +364,7 @@ int main(int argc, char **argv)
} }
/* /*
* If new and old parameters do match but TACs did not, then add * If new and old parameters do match but TACs did not, then add new TAC row(s)
* new TAC row(s)
*/ */
if(samepars) { if(samepars) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment