CLISH  0.7.3
shell.h
1 /*
2  * shell.h
3  */
12 #ifndef _clish_shell_h
13 #define _clish_shell_h
14 
15 #include <stdio.h>
16 #include <pthread.h>
17 
18 #include "lub/c_decl.h"
19 #include "lub/types.h"
20 #include "lub/argv.h"
21 
22 #include "tinyrl/tinyrl.h"
23 
24 #include "view.h"
25 
26 _BEGIN_C_DECL
27 
28 typedef struct clish_shell_s clish_shell_t;
29 
30 /*=====================================
31  * SHELL INTERFACE
32  *===================================== */
54 typedef bool_t
59  const clish_shell_t *shell
60  );
61 
77 typedef void
82  const clish_shell_t *shell
83  );
84 
96 typedef void
101  const clish_shell_t *instance,
105  const char *cmd_line
106  );
107 
129 typedef bool_t
134  const clish_shell_t *instance,
138  const char *script
139  );
140 
162 typedef bool_t
167  const clish_shell_t *instance,
173  const char *access
174  );
189 typedef bool_t
194  const clish_shell_t *instance,
198  const lub_argv_t *argv
199  );
200 
205 typedef struct
206 {
207  const char *name;
212 
218 typedef struct
219 {
227 /*-----------------
228  * meta functions
229  *----------------- */
230 int
231  clish_shell_spawn_and_wait(const clish_shell_hooks_t *hooks,
232  void *cookie);
248 bool_t
254  pthread_t *pthread,
260  const pthread_attr_t *attr,
266  const clish_shell_hooks_t *hooks,
271  void *cookie
272  );
273 bool_t
274  clish_shell_spawn_from_file(const clish_shell_hooks_t *hooks,
275  void *cookie,
276  const char *filename);
277 
278 clish_shell_t *
279  clish_shell_new(const clish_shell_hooks_t *hooks,
280  void *cookie,
281  FILE *istream);
282 /*-----------------
283  * methods
284  *----------------- */
285 /*
286  * Called to invoke the startup command for this shell
287  */
288 bool_t
289  clish_shell_startup(clish_shell_t *instance);
290 void
291  clish_shell_delete(clish_shell_t *instance);
292 clish_view_t *
293  clish_shell_find_create_view(clish_shell_t *instance,
294  const char *name,
295  const char *prompt);
296 clish_ptype_t *
297  clish_shell_find_create_ptype(clish_shell_t *instance,
298  const char *name,
299  const char *text,
300  const char *pattern,
301  clish_ptype_method_e method,
302  clish_ptype_preprocess_e preprocess);
303 int
304  clish_shell_xml_read(clish_shell_t *instance,
305  const char *filename);
306 void
307  clish_shell_help(clish_shell_t *instance,
308  const char *line);
309 bool_t
310  clish_shell_execute(clish_shell_t *instance,
311  const clish_command_t *cmd,
312  clish_pargv_t **pargv);
313 bool_t
314  clish_shell_readline(clish_shell_t *shell,
315  const char *prompt,
316  const clish_command_t **cmd,
317  clish_pargv_t **pargv);
318 void
319  clish_shell_set_context(clish_shell_t *instance,
320  const char *viewname);
321 void
322  clish_shell_dump(clish_shell_t *instance);
323 void
324  clish_shell_close(clish_shell_t *instance);
325 /*-----------------
326  * attributes
327  *----------------- */
328 const clish_view_t *
329  clish_shell__get_view(const clish_shell_t *instance);
330 const char *
331  clish_shell__get_viewid(const clish_shell_t *instance);
332 const char *
333  clish_shell__get_overview(const clish_shell_t *instance);
334 tinyrl_t *
335  clish_shell__get_tinyrl(const clish_shell_t *instance);
336 void *
337  clish_shell__get_client_cookie(const clish_shell_t *instance);
338 
339 _END_C_DECL
340 #endif /* _clish_shell_h */
341 
const clish_shell_builtin_t * cmd_list
Definition: shell.h:225
void clish_shell_fini_fn_t(const clish_shell_t *shell)
Definition: shell.h:78
struct lub_argv_s lub_argv_t
Definition: argv.h:35
clish_shell_access_fn_t * access_fn
Definition: shell.h:221
clish_shell_builtin_fn_t * callback
Definition: shell.h:210
bool_t clish_shell_script_fn_t(const clish_shell_t *instance, const char *script)
Definition: shell.h:130
bool_t clish_shell_builtin_fn_t(const clish_shell_t *instance, const lub_argv_t *argv)
Definition: shell.h:190
void clish_shell_cmd_line_fn_t(const clish_shell_t *instance, const char *cmd_line)
Definition: shell.h:97
bool_t clish_shell_init_fn_t(const clish_shell_t *shell)
Definition: shell.h:55
clish_shell_init_fn_t * init_fn
Definition: shell.h:220
bool_t clish_shell_spawn(pthread_t *pthread, const pthread_attr_t *attr, const clish_shell_hooks_t *hooks, void *cookie)
const char * name
Definition: shell.h:207
bool_t
Definition: types.h:18
clish_shell_script_fn_t * script_fn
Definition: shell.h:223
bool_t clish_shell_access_fn_t(const clish_shell_t *instance, const char *access)
Definition: shell.h:163
Definition: shell.h:205
Definition: shell.h:218
clish_ptype_method_e
Definition: ptype.h:35
clish_shell_fini_fn_t * fini_fn
Definition: shell.h:224
clish_ptype_preprocess_e
Definition: ptype.h:61
clish_shell_cmd_line_fn_t * cmd_line_fn
Definition: shell.h:222