]> git.ipfire.org Git - thirdparty/bash.git/blame - pcomplete.h
Imported from ../bash-2.05b.tar.gz.
[thirdparty/bash.git] / pcomplete.h
CommitLineData
bb70624e
JA
1/* pcomplete.h - structure definitions and other stuff for programmable
2 completion. */
3
7117c2d2 4/* Copyright (C) 1999-2002 Free Software Foundation, Inc.
bb70624e
JA
5
6 This file is part of GNU Bash, the Bourne Again SHell.
7
8 Bash is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 2, or (at your option) any later
11 version.
12
13 Bash is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
17
18 You should have received a copy of the GNU General Public License along
19 with Bash; see the file COPYING. If not, write to the Free Software
20 Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
21
22#if !defined (_PCOMPLETE_H_)
23# define _PCOMPLETE_H_
24
25#include "stdc.h"
26#include "hashlib.h"
27
28typedef struct compspec {
29 int refcount;
30 unsigned long actions;
28ef6c31 31 unsigned long options;
bb70624e
JA
32 char *globpat;
33 char *words;
34 char *prefix;
35 char *suffix;
36 char *funcname;
37 char *command;
38 char *filterpat;
39} COMPSPEC;
40
41/* Values for COMPSPEC actions. These are things the shell knows how to
42 build internally. */
43#define CA_ALIAS (1<<0)
44#define CA_ARRAYVAR (1<<1)
45#define CA_BINDING (1<<2)
46#define CA_BUILTIN (1<<3)
47#define CA_COMMAND (1<<4)
48#define CA_DIRECTORY (1<<5)
49#define CA_DISABLED (1<<6)
50#define CA_ENABLED (1<<7)
51#define CA_EXPORT (1<<8)
52#define CA_FILE (1<<9)
53#define CA_FUNCTION (1<<10)
f73dda09
JA
54#define CA_GROUP (1<<11)
55#define CA_HELPTOPIC (1<<12)
56#define CA_HOSTNAME (1<<13)
57#define CA_JOB (1<<14)
58#define CA_KEYWORD (1<<15)
59#define CA_RUNNING (1<<16)
7117c2d2
JA
60#define CA_SERVICE (1<<17)
61#define CA_SETOPT (1<<18)
62#define CA_SHOPT (1<<19)
63#define CA_SIGNAL (1<<20)
64#define CA_STOPPED (1<<21)
65#define CA_USER (1<<22)
66#define CA_VARIABLE (1<<23)
bb70624e 67
28ef6c31
JA
68/* Values for COMPSPEC options field. */
69#define COPT_RESERVED (1<<0) /* reserved for other use */
70#define COPT_DEFAULT (1<<1)
71#define COPT_FILENAMES (1<<2)
72#define COPT_DIRNAMES (1<<3)
7117c2d2 73#define COPT_NOSPACE (1<<4)
bb70624e
JA
74
75/* List of items is used by the code that implements the programmable
76 completions. */
77typedef struct _list_of_items {
78 int flags;
f73dda09 79 int (*list_getter) __P((struct _list_of_items *)); /* function to call to get the list */
bb70624e
JA
80
81 STRINGLIST *slist;
82
83 /* These may or may not be used. */
84 STRINGLIST *genlist; /* for handing to the completion code one item at a time */
85 int genindex; /* index of item last handed to completion code */
86
87} ITEMLIST;
88
89/* Values for ITEMLIST -> flags */
90#define LIST_DYNAMIC 0x001
91#define LIST_DIRTY 0x002
92#define LIST_INITIALIZED 0x004
93#define LIST_MUSTSORT 0x008
94#define LIST_DONTFREE 0x010
95#define LIST_DONTFREEMEMBERS 0x020
96
97extern HASH_TABLE *prog_completes;
98extern int prog_completion_enabled;
99
100/* Not all of these are used yet. */
101extern ITEMLIST it_aliases;
102extern ITEMLIST it_arrayvars;
103extern ITEMLIST it_bindings;
104extern ITEMLIST it_builtins;
105extern ITEMLIST it_commands;
106extern ITEMLIST it_directories;
107extern ITEMLIST it_disabled;
108extern ITEMLIST it_enabled;
109extern ITEMLIST it_exports;
110extern ITEMLIST it_files;
111extern ITEMLIST it_functions;
f73dda09 112extern ITEMLIST it_groups;
bb70624e
JA
113extern ITEMLIST it_hostnames;
114extern ITEMLIST it_jobs;
115extern ITEMLIST it_keywords;
116extern ITEMLIST it_running;
7117c2d2 117extern ITEMLIST it_services;
bb70624e
JA
118extern ITEMLIST it_setopts;
119extern ITEMLIST it_shopts;
120extern ITEMLIST it_signals;
121extern ITEMLIST it_stopped;
122extern ITEMLIST it_users;
123extern ITEMLIST it_variables;
124
125/* Functions from pcomplib.c */
7117c2d2
JA
126extern COMPSPEC *compspec_create __P((void));
127extern void compspec_dispose __P((COMPSPEC *));
128extern COMPSPEC *compspec_copy __P((COMPSPEC *));
bb70624e 129
7117c2d2
JA
130extern void progcomp_create __P((void));
131extern void progcomp_flush __P((void));
132extern void progcomp_dispose __P((void));
bb70624e 133
7117c2d2 134extern int progcomp_size __P((void));
bb70624e 135
7117c2d2
JA
136extern int progcomp_insert __P((char *, COMPSPEC *));
137extern int progcomp_remove __P((char *));
bb70624e 138
7117c2d2 139extern COMPSPEC *progcomp_search __P((const char *));
bb70624e 140
7117c2d2 141extern void progcomp_walk __P((hash_wfunc *));
bb70624e
JA
142
143/* Functions from pcomplete.c */
144extern void set_itemlist_dirty __P((ITEMLIST *));
145
f73dda09
JA
146extern STRINGLIST *completions_to_stringlist __P((char **));
147
28ef6c31
JA
148extern STRINGLIST *gen_compspec_completions __P((COMPSPEC *, const char *, const char *, int, int));
149extern char **programmable_completions __P((const char *, const char *, int, int, int *));
bb70624e
JA
150
151#endif /* _PCOMPLETE_H_ */