bridge/class-master/depend/pari/src/gp/texmacs.c
/* completion required, cursor on s + pos. Complete wrt strict left prefix */
completion required, cursor on s + pos. Complete wrt strict left prefix
completion required cursor on s + pos . Complete wrt strict left prefix
static void
tm_completion(const char *s, long pos)
{
  char **matches, *text;
  long w;
  matches = pari_completion_matches(&pari_rl, s, pos, &w);
  text = *pari_rl.line_buffer + w;
  printf("%cscheme:(tuple",DATA_BEGIN);
  if (matches)
  {
    long i, prelen = (rl_line_buffer+pos) - text;
    char *t = (char*)pari_malloc(prelen+1);
    strncpy(t, text, prelen); t[prelen] = 0; 
    printf(" ");
    print_escape_string(t); pari_free(t);
    for (i = matches[1]? 1: 0; matches[i]; i++)
    {
      printf(" ");
      print_escape_string(matches[i] + prelen);
      pari_free(matches[i]);
    }
    pari_free(matches);
  }
  printf(")%c", DATA_END);
  fflush(stdout);
}
static void tm_completion ( const char * s , long pos ) { char * * matches , * text ; long w ; matches = pari_completion_matches ( & pari_rl , s , pos , & w ) ; text = * pari_rl . line_buffer + w ; printf ( " " , DATA_BEGIN ) ; if ( matches ) { long i , prelen = ( rl_line_buffer + pos ) - text ; char * t = ( char * ) pari_malloc ( prelen + 1 ) ; strncpy ( t , text , prelen ) ; t [ prelen ] = 0 ; printf ( " " ) ; print_escape_string ( t ) ; pari_free ( t ) ; for ( i = matches [ 1 ] ? 1 : 0 ; matches [ i ] ; i ++ ) { printf ( " " ) ; print_escape_string ( matches [ i ] + prelen ) ; pari_free ( matches [ i ] ) ; } pari_free ( matches ) ; } printf ( " " , DATA_END ) ; fflush ( stdout ) ; }
completion required, cursor on s + pos.
completion required cursor on s + pos .
/* prefix */