OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
strlist.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2004-2007, Remik Ziemlinski @ noaa gov
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; either version 2, or (at your option)
7  any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program; see the file COPYING.
16  If not, write to the Free Software Foundation,
17  59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18  */
19 
20 #ifndef STRLIST_H
21 #define STRLIST_H 1
22 
23 #include "common.h"
24 
25 /* 0 success, 1 fail; allocates memory and sets n=0 */
26 int newstringlist(char*** list, int* n, int size);
27 /* 0 success, 1 fail; frees memory for each string, but not list of strings */
28 int clearstringlist(char** list, int n);
29 /* traverses comma-delimited string, returns list and number of list items */
30 void getstringlist(char *optarg, char*** list, int* nitems);
31 /* free variablelist or excludelist. Internally sets *list to NULL. */
32 void freestringlist(char*** list, int nitems);
33 /* check membership; returns 0 - false, 1 - true */
34 int instringlist(char** list, char* str, int nitems);
35 /* Does deep copy of string. Fails if list is full (no NULL entries). */
36 int addstringtolist(char** list, char* string, int nitems);
37 int appendstringtolist(char*** list, const char* string, int *nitems);
38 void printstrlist(char** list, int n, FILE* f);
39 
40 /* find string list union; "union" must already be allocated to
41  accomodate size(set1) + size(set2)
42  does not assume listunion is empty, therefore can use as a copy function
43  */
44 int strlistu(char** list1, char** list2, char** listunion, int n1, int n2, int nu);
45 /* find string list simple difference;
46  list1 items are returned unless exist in list2
47  "diff" must already be allocated to
48  accomodate size(set1) + size(set2) worst case.
49  */
50 int strlistsd(char** list1, char** list2, char** listdiff, int n1, int n2, int nsd);
51 
52 /* Does deep copy. Requires ndst >= nsrc. Strings in listdst after nsrc position are left intact.*/
53 int copystrlist(char** listsrc, char** listdst, int nsrc, int ndst);
54 /* Get number of strings in list, which don't have to occupy every array position contiguously. */
55 int getnumstrlist(char** list, int nlist);
56 
57 #endif /* !STRLIST_H */
int copystrlist(char **listsrc, char **listdst, int nsrc, int ndst)
Definition: strlist.c:221
void printstrlist(char **list, int n, FILE *f)
Definition: strlist.c:99
list(APPEND LIBS ${PGSTK_LIBRARIES}) add_executable(atteph_info_modis atteph_info_modis.c) target_link_libraries(atteph_info_modis $
Definition: CMakeLists.txt:7
void freestringlist(char ***list, int nitems)
Definition: strlist.c:88
int strlistu(char **list1, char **list2, char **listunion, int n1, int n2, int nu)
Definition: strlist.c:171
double precision function f(R1)
Definition: tmd.lp.f:1454
int newstringlist(char ***list, int *n, int size)
Definition: strlist.c:22
int strlistsd(char **list1, char **list2, char **listdiff, int n1, int n2, int nsd)
Definition: strlist.c:198
int getnumstrlist(char **list, int nlist)
Definition: strlist.c:242
const char * str
Definition: l1c_msi.cpp:35
int clearstringlist(char **list, int n)
Definition: strlist.c:36
int addstringtolist(char **list, char *string, int nitems)
Definition: strlist.c:129
int appendstringtolist(char ***list, const char *string, int *nitems)
Definition: strlist.c:152
int instringlist(char **list, char *str, int nitems)
Definition: strlist.c:107
void getstringlist(char *optarg, char ***list, int *nitems)
Definition: strlist.c:53