TPCCLIB
Loading...
Searching...
No Matches
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
19static 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
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/*****************************************************************************/
int parSortByName(PAR *d, TPCSTATUS *status)
Definition parorder.c:30
void statusSet(TPCSTATUS *s, const char *func, const char *srcfile, int srcline, tpcerror error)
Definition statusmsg.c:142
Definition tpcpar.h:101
int tacNr
Definition tpcpar.h:105
PARR * r
Definition tpcpar.h:115
int _tacNr
Definition tpcpar.h:107
Definition tpcpar.h:46
int verbose
Verbose level, used by statusPrint() etc.
@ TPCERROR_FAIL
General error.
@ TPCERROR_OK
No error.
@ TPCERROR_NO_DATA
File contains no data.
Header file for libtpcpar.