1 /*
2  * Copyright (c) 1997, 1998, 1999, 2000, 2005, 2006, 2015
3  *	Tama Communications Corporation
4  *
5  * This file is part of GNU GLOBAL.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 #ifndef _PATHOP_H_
22 #define _PATHOP_H_
23 #include <stdio.h>
24 
25 #include "gparam.h"
26 #include "dbop.h"
27 #include "pool.h"
28 #include "varray.h"
29 
30 #define NEXTKEY		" __.NEXTKEY"
31 
32 /*
33  * File type
34  */
35 #define GPATH_SOURCE	1
36 #define GPATH_OTHER	2
37 #define GPATH_BOTH	3
38 /*
39  * flags
40  */
41 #define GPATH_NEARSORT	1
42 
43 typedef struct {
44 	/** set by gfind_open() */
45 	DBOP *dbop;
46 	const char *prefix;
47 	int target;
48 	int flags;
49 	int version;
50 	/** set by gfind_open() */
51 	VARRAY *path_array;
52 	POOL *pool;
53 	int index;
54 	/** set by gfind_open() and gfind_read() */
55 	int first;
56 	int eod;		/**< end of data */
57 	/* set by gfind_read() */
58 	int type;		/**< File type; set by gfind_read() */
59 	const char *path;	/**< return value of gfind_read() */
60 } GFIND;
61 
62 void set_gpath_flags(int);
63 int gpath_open(const char *, int);
64 const char *gpath_path2fid(const char *, int *);
65 const char *gpath_fid2path(const char *, int *);
66 int gpath_path2nfid(const char *, int *);
67 const char *gpath_nfid2path(int, int *);
68 const char *gpath_put(const char *, int);
69 void gpath_delete(const char *);
70 int gpath_count(int);
71 void gpath_close(void);
72 int gpath_nextkey(void);
73 GFIND *gfind_open(const char *, const char *, int, int);
74 const char *gfind_read(GFIND *);
75 void gfind_close(GFIND *);
76 
77 #endif /* ! _PATHOP_H_ */
78