TPCCLIB
Loading...
Searching...
No Matches
libtpcpar
parorder.c
Go to the documentation of this file.
1
4
/*****************************************************************************/
5
#include "tpcclibConfig.h"
6
/*****************************************************************************/
7
#include <stdio.h>
8
#include <stdlib.h>
9
#include <math.h>
10
#include <time.h>
11
#include <string.h>
12
/*****************************************************************************/
13
#include "
tpcpar.h
"
14
/*****************************************************************************/
15
16
/*****************************************************************************/
18
19
static
int
parQSortName(
const
void
*r1,
const
void
*r2)
20
{
21
int
res;
22
res=strcasecmp( ((
PARR
*)r1)->name, ((
PARR
*)r2)->name );
23
return
(res);
24
}
26
30
int
parSortByName
(
32
PAR
*d,
34
TPCSTATUS
*status
35
) {
36
int
verbose=0;
if
(status!=NULL) verbose=status->
verbose
;
37
if
(verbose>0) printf(
"%s()\n"
, __func__);
38
/* Check that required data exists */
39
if
(d==NULL) {
40
statusSet
(status, __func__, __FILE__, __LINE__,
TPCERROR_NO_DATA
);
41
return
TPCERROR_NO_DATA
;
42
}
43
if
(d->
tacNr
>d->
_tacNr
) {
44
statusSet
(status, __func__, __FILE__, __LINE__,
TPCERROR_FAIL
);
45
return
TPCERROR_FAIL
;
46
}
47
statusSet
(status, __func__, __FILE__, __LINE__,
TPCERROR_OK
);
48
if
(d->
tacNr
<2)
return
TPCERROR_OK
;
49
qsort(d->
r
, d->
tacNr
,
sizeof
(
PARR
), parQSortName);
50
return
TPCERROR_OK
;
51
}
52
/*****************************************************************************/
53
54
/*****************************************************************************/
parSortByName
int parSortByName(PAR *d, TPCSTATUS *status)
Definition
parorder.c:30
statusSet
void statusSet(TPCSTATUS *s, const char *func, const char *srcfile, int srcline, tpcerror error)
Definition
statusmsg.c:142
PAR
Definition
tpcpar.h:101
PAR::tacNr
int tacNr
Definition
tpcpar.h:105
PAR::r
PARR * r
Definition
tpcpar.h:115
PAR::_tacNr
int _tacNr
Definition
tpcpar.h:107
PARR
Definition
tpcpar.h:46
TPCSTATUS
Definition
tpcextensions.h:241
TPCSTATUS::verbose
int verbose
Verbose level, used by statusPrint() etc.
Definition
tpcextensions.h:242
TPCERROR_FAIL
@ TPCERROR_FAIL
General error.
Definition
tpcextensions.h:192
TPCERROR_OK
@ TPCERROR_OK
No error.
Definition
tpcextensions.h:191
TPCERROR_NO_DATA
@ TPCERROR_NO_DATA
File contains no data.
Definition
tpcextensions.h:203
tpcpar.h
Header file for libtpcpar.
Generated on Fri Sep 19 2025 13:32:18 for TPCCLIB by
1.12.0