TPCCLIB
Loading...
Searching...
No Matches
tacname.c
Go to the documentation of this file.
1
4/*****************************************************************************/
5#include "tpcclibConfig.h"
6/*****************************************************************************/
7#include "tpcift.h"
8/*****************************************************************************/
9#include <stdio.h>
10#include <stdlib.h>
11#include <math.h>
12#include <time.h>
13#include <string.h>
14/*****************************************************************************/
15#include "tpctac.h"
16/*****************************************************************************/
17
18/*****************************************************************************/
26 TAC *tac
27) {
28 if(tac==NULL || tac->tacNr<1) return(0);
29 int ri, rj;
30 /* First check that names do exist */
31 for(ri=0; ri<tac->tacNr; ri++) {
32 if(!roinameExists(tac->c[ri].name)) return(0);
33 }
34 /* If just one TAC, then its name is individual */
35 if(tac->tacNr==1) return(1);
36 /* Otherwise compare each of the names */
37 for(ri=0; ri<tac->tacNr-1; ri++)
38 for(rj=ri+1; rj<tac->tacNr; rj++)
39 if(strcasecmp(tac->c[ri].name, tac->c[rj].name)==0) return(0);
40 return(1);
41}
42/*****************************************************************************/
43
44/*****************************************************************************/
52 TAC *tac
53) {
54 if(tac==NULL || tac->tacNr<1) return;
55 int ri, u, n;
56 u=tac->tacNr; n=1; while((u/=10)>=1) n++;
58 for(ri=0; ri<tac->tacNr; ri++) {
59 if(!roinameExists(tac->c[ri].name))
60 sprintf(tac->c[ri].name, "%0*d", n, 1+ri);
61 }
62 return;
63}
64/*****************************************************************************/
65
66/*****************************************************************************/
int roinameExists(char *roiname)
Verifies whether TAC name exists or not.
Definition roiname.c:158
char name[MAX_TACNAME_LEN+1]
Definition tpctac.h:81
Definition tpctac.h:87
TACC * c
Definition tpctac.h:117
int tacNr
Definition tpctac.h:91
void tacEnsureNames(TAC *tac)
Definition tacname.c:50
int tacIndividualNames(TAC *tac)
Definition tacname.c:24
#define MAX_TACNAME_LEN
Max length of TAC ID name (not including trailing zero).
Header file for library libtpcift.
Header file for library libtpctac.