pancake d5138a7c1d * Huge refactoring for r_cons and r_line
- Reduce the use of global variables by packing all them in a struct
  - Redesign the autocompletion method for r_line
    - Not yet finished, but so much refactoring out there :)
  - Using the singleton format (r_xxx_instance)
  - APIs has been cleaned up
  - Some bugs fixed
  - Syntax fixes

--HG--
rename : libr/cons/print.c => libr/cons/filter.c
2010-01-30 14:02:53 +01:00

56 lines
1.5 KiB
Plaintext

* 'Supr' key not handled properly
* Optionally link against libreadline (NO PLZ)
* Remove all label-related stuff (OW YEAH)
* Make dietline fully compatible with readline (WHY?)
* Define API outside as r_line_... in ../include/
Design:
=======
r_line API
- N-level commands autocompletion
- autocompletion methods:
- from an array of strings
- this array of strings can be generated by a callback
that identifies the word number
- we can just assign a function pointer to the tree of keywords
- autocompletion function is defined by first word and Nword.
- this is:
ls [file]
ls -[flags] [file]
x @ [num]
/<tab> files
if word_count==0 && word[0]=='/':
return autocomplete_filename
RLineCompletion* level0 = {
{ },
{},
NULL
};
typedef int (*RLineCompletion)(RLine *line);
#define R_LINE_NCOMP 8
typedef struct r_line_t {
char *prompt;
int word;
RLineCompletion *root;
RLineCompletion *child[R_LINE_NCOMP]; /* 8 nested levels of completion */
} RLine;
r_line_instance.root (&r_line_instance);
r_line_instance.child[0] ();
level0 completion
level1 completion is defined by level0 word
we need a stack of completion methods defined by each completion method
- this can be done by a statik array of funptr
---
// TODO : FULL READLINE COMPATIBILITY
// rl_attempted_completion_function = rad_autocompletion;
// char **rad_autocompletion(const char *text, int start, int end)
// return matches = rl_completion_matches (text, rad_offset_matches);