1 /* pcomplete.h - structure definitions and other stuff for programmable
4 /* Copyright (C) 1999 Free Software Foundation, Inc.
6 This file is part of GNU Bash, the Bourne Again SHell.
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
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
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. */
22 #if !defined (_PCOMPLETE_H_)
23 # define _PCOMPLETE_H_
28 typedef struct compspec {
30 unsigned long actions;
40 /* Values for COMPSPEC actions. These are things the shell knows how to
42 #define CA_ALIAS (1<<0)
43 #define CA_ARRAYVAR (1<<1)
44 #define CA_BINDING (1<<2)
45 #define CA_BUILTIN (1<<3)
46 #define CA_COMMAND (1<<4)
47 #define CA_DIRECTORY (1<<5)
48 #define CA_DISABLED (1<<6)
49 #define CA_ENABLED (1<<7)
50 #define CA_EXPORT (1<<8)
51 #define CA_FILE (1<<9)
52 #define CA_FUNCTION (1<<10)
53 #define CA_HELPTOPIC (1<<11)
54 #define CA_HOSTNAME (1<<12)
55 #define CA_JOB (1<<13)
56 #define CA_KEYWORD (1<<14)
57 #define CA_RUNNING (1<<15)
58 #define CA_SETOPT (1<<16)
59 #define CA_SHOPT (1<<17)
60 #define CA_SIGNAL (1<<18)
61 #define CA_STOPPED (1<<19)
62 #define CA_USER (1<<20)
63 #define CA_VARIABLE (1<<21)
65 /* This is a general-purpose argv-style array struct that should be used
67 typedef struct _list_of_strings {
73 /* List of items is used by the code that implements the programmable
75 typedef struct _list_of_items {
77 Function *list_getter; /* function to call to get the list */
81 /* These may or may not be used. */
82 STRINGLIST *genlist; /* for handing to the completion code one item at a time */
83 int genindex; /* index of item last handed to completion code */
87 /* Values for ITEMLIST -> flags */
88 #define LIST_DYNAMIC 0x001
89 #define LIST_DIRTY 0x002
90 #define LIST_INITIALIZED 0x004
91 #define LIST_MUSTSORT 0x008
92 #define LIST_DONTFREE 0x010
93 #define LIST_DONTFREEMEMBERS 0x020
95 extern HASH_TABLE *prog_completes;
96 extern int prog_completion_enabled;
98 /* Not all of these are used yet. */
99 extern ITEMLIST it_aliases;
100 extern ITEMLIST it_arrayvars;
101 extern ITEMLIST it_bindings;
102 extern ITEMLIST it_builtins;
103 extern ITEMLIST it_commands;
104 extern ITEMLIST it_directories;
105 extern ITEMLIST it_disabled;
106 extern ITEMLIST it_enabled;
107 extern ITEMLIST it_exports;
108 extern ITEMLIST it_files;
109 extern ITEMLIST it_functions;
110 extern ITEMLIST it_hostnames;
111 extern ITEMLIST it_jobs;
112 extern ITEMLIST it_keywords;
113 extern ITEMLIST it_running;
114 extern ITEMLIST it_setopts;
115 extern ITEMLIST it_shopts;
116 extern ITEMLIST it_signals;
117 extern ITEMLIST it_stopped;
118 extern ITEMLIST it_users;
119 extern ITEMLIST it_variables;
121 /* Functions from pcomplib.c */
123 extern COMPSPEC *alloc_compspec __P((void));
124 extern void free_compspec __P((COMPSPEC *));
126 extern COMPSPEC *copy_compspec __P((COMPSPEC *));
128 extern void initialize_progcomp __P((void));
129 extern void clear_progcomps __P((void));
131 extern int remove_progcomp __P((char *));
132 extern int add_progcomp __P((char *, COMPSPEC *));
134 extern int num_progcomps __P((void));
136 extern COMPSPEC *find_compspec __P((char *));
138 extern void print_all_compspecs __P((VFunction *));
140 /* Functions from pcomplete.c */
141 extern void set_itemlist_dirty __P((ITEMLIST *));
143 extern STRINGLIST *gen_compspec_completions __P((COMPSPEC *, char *, char *, int, int));
144 extern char **programmable_completions __P((char *, char *, int, int, int *));
146 #endif /* _PCOMPLETE_H_ */