1 /********************************************************************
2  * $Author: jgoerzen $
3  * $Revision: 1.1 $
4  * $Date: 2000/08/19 00:28:56 $
5  * $Source: /home/jgoerzen/tmp/gopher-umn/gopher/head/object/GDgopherdir.h,v $
6  * $State: Exp $
7  *
8  * Paul Lindner, University of Minnesota CIS.
9  *
10  * Copyright 1991, 1992 by the Regents of the University of Minnesota
11  * see the file "Copyright" in the distribution for conditions of use.
12  *********************************************************************
13  * MODULE: GDgopherdir.h
14  * Header file/abstraction of a gopher directory
15  *********************************************************************
16  * Revision History:
17  * $Log: GDgopherdir.h,v $
18  * Revision 1.1  2000/08/19 00:28:56  jgoerzen
19  * Initial revision
20  *
21  * Revision 3.7  1995/10/31  16:47:57  lindner
22  * Switch to void+ pointer
23  *
24  * Revision 3.6  1995/09/25  22:07:17  lindner
25  * Ansification
26  *
27  * Revision 3.5  1994/07/21  22:26:37  lindner
28  * Alan's GDlocation stuff
29  *
30  * Revision 3.4  1994/01/21  04:47:20  lindner
31  * Add function prototypes
32  *
33  * Revision 3.3  1994/01/10  03:29:07  lindner
34  * New Method GDsetNumitems()
35  *
36  * Revision 3.2  1993/04/15  21:35:59  lindner
37  * Changed protos
38  *
39  * Revision 3.1.1.1  1993/02/11  18:03:03  lindner
40  * Gopher+1.2beta release
41  *
42  * Revision 1.1  1992/12/10  23:27:52  lindner
43  * gopher 1.1 release
44  *
45  *
46  *********************************************************************/
47 
48 #ifndef GDGOPHERDIR_H
49 #define GDGOPHERDIR_H
50 #include "GSgopherobj.h"
51 #include "DAarray.h"
52 
53 /****************************************************************
54 ** A Gopher directory structure...
55 ** Features dynamic growth among other things...
56 **
57 *****************************************************************/
58 
59 struct g_dir_struct {
60      String *Title;
61 
62      GopherObj *Location;
63 
64      DynArray *Gophers;
65 
66      int currentitem;
67 };
68 
69 typedef struct g_dir_struct GopherDirObj;
70 typedef struct g_dir_struct *GopherDirObjp;
71 
72 #define GDgetEntry(a,b)    ((GopherObj *)(DAgetEntry((a)->Gophers,(b))))
73 #define GDgetTitle(a)      (STRget((a)->Title))
74 #define GDsetTitle(a,b)    (STRset((a)->Title,b))
75 #define GDgetLocation(a)   ((a)->Location)
76 #define GDgetNumitems(a)   (DAgetNumitems((a)->Gophers))
77 #define GDsetNumitems(a,b) (DAsetTop((a)->Gophers,(b)))
78 
79 #define GDsetCurrentItem(a,b) ((a)->currentitem=b)
80 #define GDgetCurrentItem(a) ((a)->currentitem)
81 
82 /*** Real live functions declared in GDgopherdir.c ***/
83 
84 GopherDirObj *GDnew(int size);
85 void         GDdestroy(GopherDirObj *);
86 void         GDinit(GopherDirObj *);
87 void         GDsetLocation(GopherDirObj *gd, GopherObj *gs);
88 void         GDaddGS(GopherDirObj *gd, GopherObj *gs);
89 void         GDaddGSmerge(GopherDirObj *gd, GopherObj *gs);
90 void         GDsort(GopherDirObj *);
91 void         GDtoNet(GopherDirObj *gd, int sockfd, GSformat fmt, char *ticket,
92 		     void (*prefcn)());
93 void         GDplustoNet(GopherDirObj *gd, int sockfd, char **filter,
94 			 char *ticket);
95 void         GDfromNet(GopherDirObj *gd, int sockfd, int (*eachitem)());
96 int          GDplusfromNet(GopherDirObj *gd, int fd, int (*eachitem)());
97 void         GDgrow();
98 void         GDfromLink(GopherDirObj *, FileIO *, char *, int, char*, char*);
99 void         GDtoLink(GopherDirObj *gd, int fd);
100 GopherDirObj *GDdeleteGS(GopherDirObj	*gd, int j);
101 int          GDSearch(GopherDirObj *gd, char *text);
102 #endif /* GDGOPHERDIR_H */
103 
104 
105 
106 
107 
108 
109