Lines Matching defs:result

78   int matches_dim;        /* The allocated size of result.matches[] */
79 CplMatches result; /* Completions to be returned to the caller */
152 static void cpl_plan_listing(CplMatches *result, int term_width,
158 static int cpl_format_line(CplMatches *result, CplListFormat *fmt, int lnum,
186 cpl->result.suffix = NULL;
187 cpl->result.cont_suffix = NULL;
188 cpl->result.matches = NULL;
189 cpl->result.nmatch = 0;
215 cpl->result.matches = (CplMatch *) malloc(sizeof(cpl->result.matches[0]) *
217 if(!cpl->result.matches) {
245 if(cpl->result.matches) {
246 free(cpl->result.matches);
247 cpl->result.matches = NULL;
316 if(cpl->result.nmatch+1 > cpl->matches_dim) {
318 CplMatch *matches = (CplMatch *) realloc(cpl->result.matches,
319 sizeof(cpl->result.matches[0]) * needed);
326 cpl->result.matches = matches;
348 match = cpl->result.matches + cpl->result.nmatch++;
355 cpl->result.cont_suffix = cont_suffix;
367 qsort(cpl->result.matches, cpl->result.nmatch,
368 sizeof(cpl->result.matches[0]), cpl_cmp_matches);
396 qsort(cpl->result.matches, cpl->result.nmatch,
397 sizeof(cpl->result.matches[0]), cpl_cmp_suffixes);
420 * and record a pointer to it in cpl->result.suffix. Note that this has
431 CplMatches *result; /* The result container */
437 result = &cpl->result;
441 if(result->nmatch < 1)
453 first = result->matches[0].suffix;
454 last = result->matches[result->nmatch - 1].suffix;
466 length = first - result->matches[0].suffix;
470 result->suffix = _sg_alloc_string(cpl->sg, length);
471 if(!result->suffix) {
480 strncpy(result->suffix, result->matches[0].suffix, length);
481 result->suffix[length] = '\0';
500 cpl->result.nmatch = 0;
501 cpl->result.suffix = NULL;
502 cpl->result.cont_suffix = "";
559 * cpl->result.matches.
568 * in cpl->result.common.
583 if(cpl->result.nmatch > 1)
584 cpl->result.cont_suffix = "";
588 return &cpl->result;
611 return (!cpl || *_err_get_msg(cpl->err)!='\0') ? NULL : &cpl->result;
618 * result CplMatches * The container of the sorted array of
626 int cpl_list_completions(CplMatches *result, FILE *fp, int term_width)
628 return _cpl_output_completions(result, _io_write_stdio, fp, term_width);
635 * result CplMatches * The container of the sorted array of
645 int _cpl_output_completions(CplMatches *result, GlWriteFn *write_fn, void *data,
658 if(write_fn && result && result->nmatch>0) {
662 cpl_plan_listing(result, term_width, &fmt);
667 if(cpl_format_line(result, &fmt, lnum, write_fn, data))
985 matches = cpl->result.matches;
986 nmatch = cpl->result.nmatch;
1015 cpl->result.nmatch = dst;
1024 * result CplMatches * The set of completions to be listed.
1031 static void cpl_plan_listing(CplMatches *result, int term_width,
1052 for(i=0; i<result->nmatch; i++) {
1053 CplMatch *match = result->matches + i;
1080 fmt->nline = (result->nmatch + fmt->ncol - 1) / fmt->ncol;
1089 * result CplMatches * The container of the sorted array of
1103 static int cpl_format_line(CplMatches *result, CplListFormat *fmt, int lnum,
1129 if(m < result->nmatch) {
1130 CplMatch *match = result->matches + m;