File: ext.h

package info (click to toggle)
gopher 2.3-2
  • links: PTS
  • area: non-free
  • in suites: hamm
  • size: 2,364 kB
  • ctags: 2,030
  • sloc: ansic: 22,451; perl: 1,950; sh: 1,510; makefile: 397; asm: 1
file content (127 lines) | stat: -rw-r--r-- 3,686 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/********************************************************************
 * $Author: lindner $
 * $Revision: 3.5 $
 * $Date: 1995/09/26 05:16:23 $
 * $Source: /home/arcwelder/GopherSrc/CVS/gopher+/gopherd/ext.h,v $
 * $State: Exp $
 *
 * Paul Lindner, University of Minnesota CIS.
 *
 * Copyright 1991, 1992 by the Regents of the University of Minnesota
 * see the file "Copyright" in the distribution for conditions of use.
 *********************************************************************
 * MODULE: ext.h
 * Header file and access methods for filename extension routines
 *********************************************************************
 * Revision History:
 * $Log: ext.h,v $
 * Revision 3.5  1995/09/26  05:16:23  lindner
 * more fixes...
 *
 * Revision 3.4  1995/09/25  05:02:33  lindner
 * Convert to ANSI C
 *
 * Revision 3.3  1993/10/20  03:11:57  lindner
 * Additions for regular expressions
 *
 * Revision 3.2  1993/07/23  03:18:50  lindner
 * Mods for using decoder:'s
 *
 * Revision 3.1.1.1  1993/02/11  18:02:51  lindner
 * Gopher+1.2beta release
 *
 * Revision 1.3  1993/02/09  22:13:57  lindner
 * Added Language attributes
 *
 * Revision 1.2  1993/01/30  23:57:44  lindner
 * Changed fcn prefix to EX and EXA
 *
 * Revision 1.1  1992/12/10  23:13:27  lindner
 * gopher 1.1 release
 *
 *
 *********************************************************************/


#ifndef EXT_H
#define EXT_H

#include "DAarray.h"
#include "STRstring.h"
#include "boolean.h"

/*** Map extensions to any of these ***/
#define EXT_REGEXP   128
#define EXT_ERROR   -1
#define EXT_VIEW     1
#define EXT_IGNORE   2
#define EXT_ABSTRACT 3
#define EXT_BLOCK    4
#define EXT_BLOCKREF 5
#define EXT_DECODER  6

#define EXT_IGNOREPAT (EXT_REGEXP|EXT_IGNORE)

/****************************************************
 * A structure for mapping filenames to gopher types, and G+types
 */

struct Ext_struct {
     char   Objtype;
     String *View;
     String *ViewLang;
     String *Prefix;
     String *ext;
     int    exttype;  /** One of the constants defined above **/
     String *GenericData;
};

typedef struct Ext_struct Extobj;

/*** Macros and access methods ***/

#define EXgetObjtype(a)     ((a)->Objtype)
#define EXsetObjtype(a,b)   ((a)->Objtype=(b))

#define EXgetView(a)        STRget((a)->View)
#define EXsetView(a,b)      STRset((a)->View,(b))

#define EXgetVLang(a)       STRget((a)->ViewLang)
#define EXsetVLang(a,b)     STRset((a)->ViewLang,(b))

#define EXgetPrefix(a)      STRget((a)->Prefix)
#define EXsetPrefix(a,b)    STRset((a)->Prefix,(b))

#define EXgetExt(a)         STRget((a)->ext)
#define EXsetExt(a,b)       STRset((a)->ext,(b))

#define EXgetExttype(a)     ((a)->exttype)
#define EXsetExttype(a,b)   ((a)->exttype=(b))

#define EXgetBlockname(a)   STRget((a)->GenericData)
#define EXsetBlockname(a,b) STRset((a)->GenericData,(b))

#define EXgetDecoder(a)     STRget((a)->GenericData)
#define EXsetDecoder(a,b)   STRset((a)->GenericData,(b))

Extobj   *EXnew();
void      EXdestroy(Extobj *);
void      EXcpy(Extobj *, Extobj *);


/*** Definitions for an Array of extension objects ***/

typedef DynArray ExtArray;
#define EXAnew()            (ExtArray *)(DAnew(20,EXnew,NULL,EXdestroy,EXcpy))
#define EXAdestroy(a)       (DAdestroy(a))
#define EXAgetEntry(a,b)    (Extobj *)(DAgetEntry((DynArray*)a,b))
#define EXAadd(a,b)         (DApush((DynArray*)a,(char*)b))
#define EXAgetNumEntries(a) (DAgetTop(a))

boolean   EXAprocessLine(ExtArray *, int exttype, char *, char *);
boolean   EXAsearch(ExtArray *, Extobj *, char *, int);
boolean   EXAviewSearch(ExtArray *, Extobj *, char *);
char *    EXAfindFile(ExtArray *, char*, char*);

#endif /** EXT_H **/